Let's just take a (very) basic example, and see if you can figure out how/where to use it in your application:
PHP Code:
$result mysql_query($sql);
if(
mysql_num_rows($result) > 0) {
  
// do the stuff you want to do when results are found here
}
else {
  
// no results were found, so handle that situation here, for example:
  
echo "<p>Sorry, no results matched your search.</p>";