RE: [PHP-DB] Using a loop on a result destroys array??

From: Date: Thu, 25 Nov 2004 06:14:05 +0000
Subject: RE: [PHP-DB] Using a loop on a result destroys array??
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-37409@lists.php.net to get a copy of this message
On Thu, 25 Nov 2004 01:36, Mark Benson wrote: > > On Wednesday, November 24, 2004, at 02:40PM, Norland, Martin > <Martin.Norland@STJUDE.ORG> 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.

« previous php.db (#37409) next »