Posted by TristaSD on 05/16/06 22:30
Very effifient. Mine is a monster - I did a query inside a query:
$locationquery = mysql_query ("SELECT * FROM locations");
$comparequery = mysql_query ("SELECT location FROM reservations WHERE
id=" . $_GET['id']);
while ($compareresult = mysql_fetch_array ($comparequery)) {
while ($locationrow = mysql_fetch_array ($locationquery)) {
echo ("<option");
if ($locationrow['name'] == $compareresult['location']) { //the
magic happens here
echo (" selected");
}
echo (">$locationrow[name]</option>");
}
}
Because $comparequery fetches only one value, any way to retrieve it
BEFORE going into the forst loop?
[Back to original message]
|