hello everyone,
i am making a web based interface using php and the database is mysql.
i have to display information from 2 tables...i got the information from one table displayed fine...but i just cant get the information from the other table to get displayed...my sql is correct since it works in mysql...
i think i just dont know where to insert the correct lines in php...the following is the snippet of my code...$query works fine...how do i display the name from query1
thanks a ton
<?
include "connection.php";
$query = "SELECT ID, firstName, lastName, username, dateCreated, dateModified,idValue FROM users WHERE ID=$ID;";
$query1= "SELECT users.ID, users.idType,name FROM users, id_types
where users.ID=$ID and users.idType=id_types.ID;";
$res = db_query($query);
if ($row=db_fetch_array($res)) {
echo "<H1>Viewing record </H1><br>\n";
extract($row); // Extract turns field names into variables
echo "<b>FIRSTNAME:</b> $firstName<br>\n";
echo "<b>LASTNAME:</b> $lastName<br>\n";
echo "<b>USERNAME:</b> $username<br>\n";
echo "<b>EMAIL ADDRESS:</b> $primaryEmail<br>\n";
$date_Created=explode(" ",$dateCreated);
echo "<b>DATE CREATED(yy-mm-dd):</b> $date_Created[0]<br>\n";
$date_Modified=explode(" ",$dateModified);
echo "<b>DATE MODIFIED(yy-mm-dd):</b> $date_Modified[0]<br>\n";
echo "<b>VALUE OF ID:</b> $idValue<br>\n";
?>
<FORM action="edit.php" method="get">
<INPUT type="hidden" name="ID" value="<?=$ID?>">
<INPUT type="submit" name="Edit" value="Edit this item">
</FORM>
<?
// In the above, the HTML block lies within a php loop. However, iut isn't really a loop,
// because only one ID will match, so only one record should be returned...
}
?>