Re: trouble with function
| From: | Justin French | Date: | Sun, 25 Aug 2002 16:15:52 +0000 |
| Subject: | Re: trouble with function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114062@lists.php.net to get a copy of this message | ||
Thanks for all your help :)
Justin
on 26/08/02 1:55 AM, Michael Sims (mhsims@midsouth.rr.com) wrote:
> 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.
> :-)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>