|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-11 20:58 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 03:00:01 2025 UTC |
Description: ------------ Using PDO::FETCH_KEY_PAIR as an argument to PDOStatement->setFetchMode() cause an error. Note : PDO::FETCH_KEY_PAIR works well when used directly as an argument to fetchAll() without setFetchMode(). Reproduce code: --------------- $dbh = new PDO($dsn, $login, $password); $sql = 'SELECT id, login FROM user u'; $results = $dbh->query($sql); $results->setFetchMode(PDO::FETCH_KEY_PAIR); print_r($results->fetchAll()); Expected result: ---------------- An associative array ('id' => 'login') Actual result: -------------- SQLSTATE[22003]: Numeric value out of range: Invalid fetch mode specified