RE: [PHP-DB] checking for results return from mysql

From: Date: Sun, 05 Aug 2001 21:04:54 +0000
Subject: RE: [PHP-DB] checking for results return from mysql
Groups: php.db 
Request: Send a blank email to php-db+get-11083@lists.php.net to get a copy of this message
At Sunday, 5 August 2001, "olinux" <olnx@yahoo.com> wrote: >try this > >$result = mysql_query($sql_query); > >if ($result) { > while ($row = mysql_fetch_array($result)) { > $var_1 = $row['var_1']; > $var_2 = $row['var_2']; > } >} > >olinux This might work: $result = mysql_query($sql_query); $num_rows = mysql_num_rows($result); if($num_rows > 0) { *** code to execute if any rows were returned *** } else { *** code to execute if zero rows were returned *** } Hope this helps! Cody

« previous php.db (#11083) next »