|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-14 09:32 UTC] tony2001@php.net
[2006-08-22 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 11:00:02 2025 UTC |
Description: ------------ Getting PDO exception (SQLSTATE[HY000]: General error: 2036) when using aggregate function on PHP5 via PDO and MySQL5. (No problem when using MySQL4 or without PDO). PHP 5.2.0RC2-dev MySQL 5.0.19 Reproduce code: --------------- // MySQL CREATE TABLE `test` ( `ids` int(11) NOT NULL, `value` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `test` -- INSERT INTO `test` VALUES (10, 23); INSERT INTO `test` VALUES (10, 13); // PHP $query = 'SELECT AVG(value) FROM test WHERE ids=10 GROUP BY ids'; $dbh = new PDO($dsn, $user, $password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $rs = $dbh->query($query); $result = $rs->fetchAll(PDO::FETCH_ASSOC); print_r($result); Expected result: ---------------- Array ( [0] => Array ( [AVG(value)] => 18.0000 ) ) Actual result: -------------- Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2036