When I get an empty recordset from the following query, I can't get it to the "no records to display" section. I'm assuming it's because there will be a $id value coming in everytime in the form of a search string. How do I get to the "no records" section?
Thanks!
Greg
<?php
$db = mysql_connect("myip", "public", "public");
mysql_select_db("mydb",$db);
if ($id) {
$result = mysql_query("SELECT * FROM restaurants WHERE rest_name LIKE '%$id%'",$db);
while($myrow = mysql_fetch_array($result)) {
printf("<a href=\"%s?id=%s\">%s </a><br>\n", "restaurantpage.php", $myrow["rest_id"], $myrow["rest_name"]);
}
}
else {
// no records to display
echo "Sorry, no records were found!";
}
?>