PEAR::DB & persistence??
| From: | Graham Clarke | Date: | Mon, 23 Jun 2003 18:46:48 +0000 |
| Subject: | PEAR::DB & persistence?? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6202@lists.php.net to get a copy of this message | ||
Using PEAR::DB w/ Postgres -- I'm finding that once I fetch rows from a DB result set, the result set is empty. See example code below. Is this the expected behavior or am I missing something?
Thanks
Graham
Using the following code example --
var_dump($a) is as expected
var_dump($b) is empty
$sql = "SELECT * FROM myTable";
$result = $db->query($sql);
$a = array(); // array to hold data
while ( $mydata = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
$thisdata = array(
'col_1' => $mydata['col_1],
'col_2' => $mydata['col_2],
'col_2' => $mydata['col_2]
);
$a[] = $thisdata;
}
$b = array(); // array to hold data
while ( $mydata = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
$thisdata = array(
'col_1' => $mydata['col_1],
'col_2' => $mydata['col_2],
'col_2' => $mydata['col_2]
);
$b[] = $thisdata;
}
Graham Clarke
GrahamC@53Tech.com
www.53Tech.com
603.643.9955