DB problem
| From: | Birgir Stefansson | Date: | Tue, 18 Jun 2002 10:00:36 +0000 |
| Subject: | DB problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-1699@lists.php.net to get a copy of this message | ||
Hi.
I'm running into some problems with porting my project from using php's
postgres functions to using the PEAR DB package. The thing is that I'm
passing a resultset into functions and having it read in several places
and now using the DB package I don't get the same result as with using
the postgres calls. Doing the first reading of the whole result set
works fine .. but doing a second one it seems that the result set has
been emptied. A simple example does somewhat what I'm doing
$res = $db->query("select name, home from acct where username='biggs'");
while($user = $res->fetchRow()) {
echo $user['name'] ." ".$user['home]."<br>";
}
while($user = $res->fetchRow()) {
echo $user['name'] ." ".$user['home]."<br>";
}
The first while() works fine and I get the expected output, a single
line. Now I was expecting the second while() to print out the same
result, but for some reason there seem to be no rows in $res when the
second while executes.
Can anyone tell me what the problem is and how to go-around it ?
Birgir Stefansson