|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-26 01:18 UTC] kalle@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 03:00:02 2026 UTC |
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'