RE: Using a loop on a result destroys array??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 25 Nov 2004 01:36, Mark Benson wrote:

>  
> On Wednesday, November 24, 2004, at 02:40PM, Norland, Martin
> <Martin.Norland@xxxxxxxxxx> wrote:
> 
>>The real problem you're having is the statement says "while there are
>>results in this query, grab them" - once you reach the end of the first
>>while loop, there are no more results, so the second one is skipped
>>right over - it's condition *never* evaluates true.
> 
> So by running a "while (mysql_fetch_array($result)" loop over a fetch
> array you effectively empty it?

Not really. What is happening is that each time you get a row from the
result set, an internal pointer is advanced to the next row; if the final
row has been requested, the pointer points to 'nowhere' and can't be
further advanced without resetting it to the first row.

Cheers
-- 
David Robley

"I won't finish in fifth place," Tom held forth.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux