Re: Re: Passing by conditional IF statement...why?

From: Date: Tue, 23 Mar 2004 02:07:14 +0000
Subject: Re: Re: Passing by conditional IF statement...why?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-181221@lists.php.net to get a copy of this message
Ryan A wrote:
if(($r = mysql_fetch_row($res)) >=1)
if($r = mysql_fetch_row($res)) will work fine if you only have one row being returned. If you have more than one that you need to loop through, then: if($r = mysql_fetch_row($res)) { do { }while($r = mysql_fetch_row($res)); } Now you have the added efficiency of not having to call mysql_num_rows() (if you don't need that value). -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#181221) next »