Page 1 of 1

Just wondering if you could check if something wasnt found..

Posted: Fri Jul 05, 2002 12:17 pm
by rsbeaulieu
ive been using a statement exactly like

Code: Select all

if( ! $qry ) { 
echo("<p>Error:".mysql_error()."</p>"); 
&#125;
the if(! $qry) is something that is used to determine if an error was found but i would like to check if you found nothing, nothing at all, zip, notta thing. So is that possible? 8O

Posted: Fri Jul 05, 2002 12:39 pm
by hob_goblin
if(empty($qry)){
}

but uhm...

!$qry should return true if nothing is found..

Posted: Fri Jul 05, 2002 12:39 pm
by RandomEngy
Do something like:

Code: Select all

$result = mysql_query("Your query here");
if( mysql_num_rows($result) == 0 )
  echo "No results found.";
else
&#123;
  // Do stuff with the results
&#125;

Posted: Fri Jul 05, 2002 1:19 pm
by rsbeaulieu
seems to be working now. Thanks. 8O

Posted: Fri Jul 05, 2002 2:02 pm
by rsbeaulieu
Hey it works like a charm now, thanks again! :D