Re: resetting record pointer
| From: | Kevin Beckford | Date: | Fri, 04 Aug 2000 16:04:35 +0000 |
| Subject: | Re: resetting record pointer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10158@lists.php.net to get a copy of this message | ||
sorry - here is the one I was thinking about;
http://www.zend.com/manual/function.mysql-data-seek.php
----- Original Message -----
From: Joe Sheble a.k.a. Wizaerd <wizaerd@wizaerd.com>
To: General PHP LIst <php-general@lists.php.net>
Sent: Friday, August 04, 2000 11:24 AM
Subject: FW: [PHP] resetting record pointer
> yeah, that does work in that instance, thanx...
>
> but I'm also assuming that there is no way to reset the current record to
> the first record? For looping through the recordset twice? I'm making a
> table that aligns to the left listing all the authors of messages. These
> are quicklinks to the actual specific messages, so I loop through the entire
> recordset putting the names in the table. Then after closing that table out
> I want to reloop through the record set to output the actual messages.
>
> Currently I'm doing it with two queries, but that also seems in efficient as
> h*ll....
>
> > -----Original Message-----
> > From: Matthew Kendall [mailto:mdkendall@hotmail.com]
> > Sent: Friday, August 04, 2000 12:25 AM
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] resetting record pointer
> >
> >
> > "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.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>