Hi,
Can anyone tell me where i am going wrong?
The table structure looks like this:
I have a table called intranet. This has a field called building_id. This value is a number which represents the name of a building.
In another table called building, the auto incrememted field is called building_id. This field is the link to the intranet table and all of its other fields.
Here is the code:
<?
// create SQL statement
$sql = "SELECT * FROM building, intranet WHERE building.building_id=intranet.building_id AND intranet.CatID=$id";
// execute SQL query and get result
$sql_result = mysql_query($sql)
or die("Couldn't execute query.");
// put data into drop-down list box
while ($row = mysql_fetch_array($sql_result)) {
$bname = $row["building_id"];
$bwas = $row["b_name"];
$option_block .= "<OPTION value=\"$bname\">$bwas</OPTION>";
}
?>
...and the output
<SELECT name="operating_system">
<? echo "$option_block"; ?>
</SELECT>
At the moment it is getting the correct value from the DB but i need it to get the other names of the buildings as well so that the user can update the building if they wish.