#47737 [Opn->Csd]: PDO constants page needs note re FETCH_KEY_PAIR
ID: 47737
Updated by: kalle@php.net
Reported By: dan dot franklin at pearson dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Red Hat Enterprise Linux 5.1
PHP Version: Irrelevant
-Assigned To:
+Assigned To: kalle
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2009-03-20 19:59:30] dan dot franklin at pearson dot com
Description:
------------
The PDO documentation page that lists the predefined constants,
/manual/en/pdo.constants.php, should note in the description of
PDO::FETCH_KEY_PAIR that this feature was added in PHP 5.2.3.
See the NEWS in the source distribution for 5.2.8, for example.
Reproduce code:
---------------
function test()
{
$dbh = new PDO("mysql:host=$GLOBALS[DEV_HOST];dbname=Fen", "fen",
"xxxxxxx");
$stmt = $dbh->prepare("select * from islands order by island_id");
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_KEY_PAIR);
}
var_dump(test());
Expected result:
----------------
I expected to get a returned array where the first column was the key
of each array element.
Actual result:
--------------
In PHP 5.1.6, attempts to use PDO::FETCH_KEY_PAIR result in
PHP Fatal error: Undefined class constant 'FETCH_KEY_PAIR'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47737&edit=1
Thread (2 messages)