Edit report at https://bugs.php.net/bug.php?id=60122&edit=1
ID: 60122 User updated by: armiksos at gmail dot com Reported by: armiksos at gmail dot com Summary: Many multi-row statements gives wrong result Status: Open Type: Bug Package: PDO related Operating System: windows 7 PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: I use MySQL driver. Previous Comments: ------------------------------------------------------------------------ [2011-12-04 17:59:00] ssuffic...@php.net Which driver are you using (i.e. MySQL, PostgreSQL, DBLIB, SqlServer?) ------------------------------------------------------------------------ [2011-10-24 14:49:39] armiksos at gmail dot com Description: ------------ If you create two query of multi-row statements in one .php file and you assign them to the same variable after processing one of them, the second query will give only result of only ONE statement. If you assign the result of query to another variable, the result will be correct. So $another_var_name = $conn->query("SELECT 1 as one; SELECT 2 as two; SELECT 3 as three;"); will work in Test script, otherwise result will be wrong. Test script: --------------- $q = $conn->query("SELECT 1 as one; SELECT 2 as two; SELECT 3 as three;"); do { $r=$q->fetchAll(PDO::FETCH_ASSOC); echo "<br />"; print_r($r); }while($q->nextRowset()); $q = $conn->query("SELECT 1 as one; SELECT 2 as two; SELECT 3 as three;"); do { $r=$q->fetchAll(PDO::FETCH_ASSOC); echo "<br />"; print_r($r); }while($q->nextRowset()); Expected result: ---------------- Array ( [0] => Array ( [one] => 1 ) ) Array ( [0] => Array ( [two] => 2 ) ) Array ( [0] => Array ( [three] => 3 ) ) Array ( [0] => Array ( [one] => 1 ) ) Array ( [0] => Array ( [two] => 2 ) ) Array ( [0] => Array ( [three] => 3 ) ) Actual result: -------------- Array ( [0] => Array ( [one] => 1 ) ) Array ( [0] => Array ( [two] => 2 ) ) Array ( [0] => Array ( [three] => 3 ) ) Array ( [0] => Array ( [one] => 1 ) ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60122&edit=1