#44646 [Opn->Bgs]: next calls of fetchAll method return empty array
| From: | derick@php.net | Date: | Sat, 05 Apr 2008 12:51:33 +0000 |
| Subject: | #44646 [Opn->Bgs]: next calls of fetchAll method return empty array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123987@lists.php.net to get a copy of this message | ||
ID: 44646
Updated by: derick@php.net
Reported By: getmequick at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: PDO related
Operating System: win XP
PHP Version: 5.2.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You can only consume a result set *once*.
Previous Comments:
------------------------------------------------------------------------
[2008-04-05 12:38:15] getmequick at gmail dot com
Description:
------------
Fetching rows using different fetch styles works for single
PDO::fetch() method, as shown here -
http://www.php.net/manual/ru/function.PDOStatement-fetch.php
Hovewer it doesn't work for PDO::fetchAll() method
Reproduce code:
---------------
<?php
$sth = $dbh->prepare("SELECT domain_name, domain_id FROM
pub_domains");
$sth->execute();
print_r($sth->fetchAll(PDO::FETCH_ASSOC));
print_r($sth->fetchAll(PDO::FETCH_BOTH));
?>
Expected result:
----------------
<?php
Array
(
[0] => Array
(
[DOMAIN_NAME] => apple.com
[DOMAIN_ID] => 3
)
)
Array
(
[0] => Array
(
[DOMAIN_NAME] => apple.com
[0] => apple.com
[DOMAIN_ID] => 3
[1] => 3
)
)
?>
Actual result:
--------------
<?php
Array
(
[0] => Array
(
[DOMAIN_NAME] => apple.com
[DOMAIN_ID] => 3
)
)
Array
(
)
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44646&edit=1