$num_rows = -1; if (!$result || mysql_err_no($result) != 0) { $num_rows = mysql_num_rows($result); } if ($num_rows >-1){ //do something here }
Don't you have that backwards? If there is a result && there is no error, do the num_rows. if ($result && mysql_err_no($result) == 0) { $num_rows = mysql_num_rows($result); } -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php