Re: mysql_numrows

From: Date: Tue, 14 Oct 2008 21:47:31 +0000
Subject: Re: mysql_numrows
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-45525@lists.php.net to get a copy of this message
$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/

« previous php.db (#45525) next »