This topic is locked

Using information from other tables

3/18/2007 10:02:11 PM
PHPRunner General questions
E
evan_ad2000 author

Hi,
Lets say I have these 2 tables, Assembly(Name, ID, Cost) and AssemblyBuild(AssemblyNumber, ComponentNumber, Type). In the pages for AssemblyBuild, the {$show_key1} is set to an attribute inside the AssemblyBuild table. How can I change that attribute to the value of Name in the Assembly Table?
Cheers,

Evan Tan

J
Jane 3/19/2007

Evan,
to display values from another table use ViewOnLoad event on the Events tab.

Here is the sample code:

global $where,$conn,$strTableName;

$str = "select Name from Assembly where ID=".$_SESSION[$strTableName."_masterkey1"];

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

echo "Name: ".$data["Name"];

E
encgraphics 12/22/2007

Evan,

to display values from another table use ViewOnLoad event on the Events tab.

Here is the sample code:


For something like this, would you have to do this on every page? I'm putting together a website with job listings: http://www.1stsgusa.com/site/index.php?opt...r&Itemid=13
Instead of seeing the value, I'm seeing the ID. What I did was set up two separate phprunner sites, one where the admin goes in to enter his jobs and another where it's just a view without a login page (what you see in the joomla site above). I'm using the same exact tables in both. In the admin site I do no see ID numbers, but rather the value. But in the view site, all i see are ID numbers rather than the value. Do I use the code above in all of the pages?