Re: resetting record pointer

From: Date: Fri, 04 Aug 2000 07:24:36 +0000
Subject: Re: resetting record pointer
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-10081@lists.php.net to get a copy of this message
"Wizaerd" <wizaerd@wizaerd.com> wrote ... > After issuing a mysql_fetch_array call, is it possible to reset > back to the first row? I make the first call to pull out a few feilds > for writing out titles, but then I want to loop through the entire > resultset starting from the very beginning. Currently I go ahead > and display the values from the first retrieved recordset, then put > the others in a while loop. The problem is the code from > displaying the first record set is duplicated inside the loop, which > seems inefficient. instead of: fetch row title stuff row stuff while( fetch row ) { row stuff } why not use: fetch row title stuff do { row stuff } while( fetch row ) The code (both versions) assumes there is always at least one result.

« previous php.general (#10081) next »