I'm having trouble figuring out how to display data from another indexed table. What I have is one table (assets) with a majority of my data in it. I use a simple select statement to display the data. Within that data is a field of "typeid" which is an indexed field to my "assettype" table. With my simple select statement I see only the indexed field "assets.typeid". I want to see the "assettype.type" field from the assettype table.
In a nutshell, i want to change the typeid of "1" to be "printer", but "printer" is in a different table that is indexed by "typeid" number. Here is a snippet, hope it helps.
$query = "SELECT * FROM assets WHERE tag = $tag"; $result = mysql_query($query) or die('Sorry, could not find tag requested'); $row = mysql_fetch_array($result, MYSQL_ASSOC) or die('No records retrieved'); $tag=$row['tag']; $typeid = $row['typeid'];
Further down the script
echo "<h3><u>Tag#</u><font color=\"#663300\" size=\"2\"> $tag</font></h3>"; echo "<h3><u>Type</u><font color=\"#663300\" size=\"2\"> $typeid</font></h3>\n";
Where $typeid is echoed, i want to echo $type instead, but it is in a different table that is indexed with $typeid.