Hi All, I'm pretty new at this, so go easy on me please ;-) What is wrong w/ this syntax? If the search results are 0, it just displays a blank screen instead of echoing the error message if numresults ==0 or the mysql_error message. If data is found, everything is fine. Thanks in advance for your help!
if($searchterm){ $query = "select directory.realname, directory.phone, directory.ext, directory.phone2, directory.email, directory.location from directory where realname like '%".$searchterm."%'" or die (mysql_error()); } elseif($location){ $query = "select directory.realname, directory.phone, directory.ext, directory.phone2, directory.email, directory.location from directory where location like '%".$location."%'" or die (mysql_error()); } else{ $query = "select directory.realname, directory.phone, directory.ext, directory.phone2, directory.email, directory.location from directory where location like '%".$searchloc."%'" or die (mysql_error()); } $result = mysql_query($query) or die (mysql_error()); $num_results = mysql_num_rows($result)or die (mysql_error());; if($num_results==0){ echo "Sorry, nothing matched your search request. Please go back and try again."; } else { echo "<p><span class=stdtext_bold>Number of Entries Found: ".$num_results."</p></span>"; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php