error msg
Posted: Fri Jan 09, 2004 3:21 pm
Hi everyone,
Below is part of my code to display search criteria if found in the database.
Where and how do I write code that just returns a message "No results found" if no search criteria are found in the db>
if (isset($_GET['surname'])) {
echo "<strong>Search Results</strong><hr />";
$db=mysql_connect("localhost","username","password");
mysql_select_db("dbname",$db);
$rs=mysql_query("SELECT * FROM Cathal_Test WHERE INSTR(UCASE(Surname), UCASE('".$_GET['surname']."'))>0",$db);
while ($r=mysql_fetch_array($rs)) {
echo "<a href=\"resultsdemo.php?action=edit&id=".$r[0]."\">".$r[1].", ".$r[2]."</a> (colour: ".strtolower($r['3']).", body part: ".strtolower($r[4]).")<br />";
}
mysql_close($db);
echo "<hr />";
Below is part of my code to display search criteria if found in the database.
Where and how do I write code that just returns a message "No results found" if no search criteria are found in the db>
if (isset($_GET['surname'])) {
echo "<strong>Search Results</strong><hr />";
$db=mysql_connect("localhost","username","password");
mysql_select_db("dbname",$db);
$rs=mysql_query("SELECT * FROM Cathal_Test WHERE INSTR(UCASE(Surname), UCASE('".$_GET['surname']."'))>0",$db);
while ($r=mysql_fetch_array($rs)) {
echo "<a href=\"resultsdemo.php?action=edit&id=".$r[0]."\">".$r[1].", ".$r[2]."</a> (colour: ".strtolower($r['3']).", body part: ".strtolower($r[4]).")<br />";
}
mysql_close($db);
echo "<hr />";