Re: trouble with function

From: Date: Sun, 25 Aug 2002 15:55:13 +0000
Subject: Re: trouble with function
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-114059@lists.php.net to get a copy of this message
On Sun, 25 Aug 2002 10:49:00 -0500, you wrote: >static $myrow; >if($myrow = mysql_fetch_array($result)) { [...] Oops. We want to remember the position of the result set, so it's $result that should be static, not $myrow. In addition, you'll have to put a check at the top of the function to see if $result is still valid, and to have it not re-run the query if it is. Otherwise you'll get the first row back every time. Come to thing of it, it's probably just easier to get all the songs back at once and then do a foreach. :-)

« previous php.general (#114059) next »