ID: 44081 Comment by: stewart dot duncan at rocketmail dot com Reported By: abouzekry at gmail dot com Status: Open Bug Type: PDO related Operating System: Windows XP SP2 PHP Version: 5.2.5 New Comment:
Really annoying this one. Reproduced on 5.2.8. Previous Comments: ------------------------------------------------------------------------ [2008-02-09 11:46:41] abouzekry at gmail dot com Description: ------------ the same code runs on php5.2.0 without any problems, while it's problematic with php5.2.5 i don't know why!, it insists on giving me the following message... Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute however i closed the cursor after each result fetch!!!! Reproduce code: --------------- if(isset($_POST['user_name'], $_POST['pass'])) { /* check wether the user exists or not */ $result = $db->query("CALL proc_check_user('{$_POST['user_name']}', '{$_POST['pass']}')") or die('0-1-Database-Query-Error-login.php:'.print_r($db->errorInfo())); $row = $result->fetchAll(PDO::FETCH_ASSOC) or die('0-2-Database-Fetch-Error-login.php:'.print_r($db->errorInfo())); /* close the DB cursor to be able to perform the other querie(s)*/ $result->closeCursor(); /* if the user doesn't exist exit prematurely! */ if($row['userExists'] == 0) { exit('0-2-Authentication-Error-login.php: User Doesnt Exist!'); } /* get the user_id and full_name */ $result = $db->query("CALL proc_get_user_data('{$_POST['user_name']}', '{$_POST['pass']}')") or die('0-3-Database-Query-Error-login.php:'.print_r($db->errorInfo())); $row = $result->fetch(PDO::FETCH_ASSOC); } Expected result: ---------------- the machine with php5.2.0 installed when running the same code produces a correct authentication for valid users (POSTed) and error for invalid users. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44081&edit=1