ID: 38433 Updated by: [EMAIL PROTECTED] Reported By: tichy at livada dot cz -Status: Open +Status: Feedback Bug Type: PDO related Operating System: Linux PHP Version: 5CVS-2006-08-11 (snap) New Comment:
Can't reproduce with 5.2-CVS and MySQL 5.0.21. Previous Comments: ------------------------------------------------------------------------ [2006-08-11 21:57:37] tichy at livada dot cz 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38433&edit=1