|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-09-16 02:17 UTC] JimmyPaterson at gmx dot de
[2008-07-03 17:11 UTC] uw@php.net
[2008-07-03 17:12 UTC] uw@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
Description: ------------ I am experiencing trouble with PHP using PDO with the MySQL driver. If using the same PDO statement multiple times, all calls but the first to execute() return FALSE, yet fetchAll() still returns the correct results (which may be cached from the first successful call). errorInfo() does not show any usable information. The problem happens with both PHP 5.2.4 on 64 Bit Gentoo as with PHP 5.2.1 on 32 Bit Ubuntu (7.04 aka Feisty Fawn). It is not reproducible on SLES10 or RHEL5 though (which both have no 5.2x PHP, I think). It's not a problem with PHP or PDO because it does not occur when using another database driver (i.e. SQLite). It is also not a problem with MySQL because execution the command multiple times per hand works fine. Some investigations using a network sniffer have shown that all three requests are properly sent to the server and correctly answered, so it should be a problem in the part that parses the answer from the MySQL server. Reproduce code: --------------- $db = new PDO( "mysql:host=localhost;dbname=pem", "pem", "pem" ); $q = $db->prepare( "SELECT * FROM test;" ); for ( $i = 1; $i <= 3; ++$i ) { if ( $q->execute() ) echo "success in $i\n"; else { echo "error in $i:\n"; print_r( $q->errorInfo() ); echo "\n"; } print_r( $q->fetchAll() ); echo "\n\n\n"; $q->closeCursor(); } Expected result: ---------------- success in 1 Array ( [0] => Array ( [abc] => just a [0] => just a [def] => test! [1] => test! ) ) error in 2: Array ( [0] => 00000 ) Array ( [0] => Array ( [abc] => just a [0] => just a [def] => test! [1] => test! ) ) error in 3: Array ( [0] => 00000 ) Array ( [0] => Array ( [abc] => just a [0] => just a [def] => test! [1] => test! ) ) Actual result: -------------- 3 times success instead of 1x success + 2x error.