Re: php - no results - display other message

From: Date: Wed, 15 Sep 2004 14:49:46 +0000
Subject: Re: php - no results - display other message
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-196738@lists.php.net to get a copy of this message
From: "Chris Dowell" <php@nodalplane.com>
Or alternatively $result = mysql_query("SELECT * FROM tablename"); if (mysql_num_rows($result)) { while ($row = mysql_fetch_row($result)) { // display results } } else echo "No results";
bah... you're wasting precious resources on a mysql_num_rows call... ;) $result = mysql_query(" ... "); if($row = mysql_fetch_assoc($result)) { do{ //display results }while($row=mysql_fetch_assoc($result)); } else { echo 'No results'; } Millions ways to do it. :) ---John Holmes...

« previous php.general (#196738) next »