DB: fetching data twice from result
| From: | Ondrej Jombik | Date: | Fri, 08 Nov 2002 12:45:45 +0000 |
| Subject: | DB: fetching data twice from result | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-2678@lists.php.net to get a copy of this message | ||
Maxim, 13:35:58
08. november 2002 (piatok)
Greetings.
Once, I have whole rows fetched and I want to fetch them once again,
there are two possibilities of doing this. There is third $rownum parameter
to fetchRow()/fetchInto() functions which defines number of particular row
to fetch.
Reliable one: During second fetch use for() loop and pass row number as a
third parameter. Note that everytime is internal DB pointer moved.
Fast one: During second fetch, call first time fetchRow()/fetchInto() with
third parameter set to 0. Others calls will be without this parameter, thus
DB pointer is moved only once at the beginning.
I'm not sure if "Fast one" will work for all DB servers. It works
well for MySQL, but I do not know about the others. Can someone give me some
advice?
Thanks,
=Nepto=
____________________________________________________________________________
Ondrej 'Nepto' Jombik, Perl CGI developer #!/usr/bin/perl -w