Re: Pear DB - Reusing a database query...
| From: | Stig Bakken | Date: | Mon, 29 Oct 2001 22:33:20 +0000 |
| Subject: | Re: Pear DB - Reusing a database query... | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-449@lists.php.net to get a copy of this message | ||
Some databases provide a "seek" function that lets you reset your result
fetching, but not all databases have it, and I'm not sure it behaves the
same way if you try after having read the last row. A "reset" or
"restart" method could be added to the DB_result class though.
- Stig
On Mon, 29 Oct 2001, David Arthur wrote:
> Any further ideas/comments on this?
>
> >>On Thursday 30 August 2001 15:15, David Arthur wrote:
> >> Is there currently a way to do this more than once?
> >>
> >> while ($row= $result->fetchRow()){
> >> print $row["fieldName"];
> >> }
> >>
> >> A way to 'reset'? the $result object rather than fetching it again
> >> with another query to run another loop on it? I've looked on the
> >> limited documentation/tutorials for info on doing this but to no
> >> avail :/
>
> >>while ($row = $result->fetchRow()){
> >> print $row["fieldName"];
> >>}
> >$n = 0;
> >// fetch row by number that it's documented
> >while ($row = $result->fetchRow(DB_FETCHMODE_DEFAULT, $n++)){
> > print $row["fieldName"];
> >}
>
> >This should work.
>
> >In the other hand, perhaps we could add a "setCursorPos" method :-?
>
>
> >Tomas V.V.Cox
>
>
>
>
>
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, e-mail: pear-general-unsubscribe@lists.php.net
> For additional commands, e-mail: pear-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>