#38861 [Asn->Bgs]: PDO retrive no mysql-results when using the same variable

From: Date: Tue, 19 Sep 2006 16:49:49 +0000
Subject: #38861 [Asn->Bgs]: PDO retrive no mysql-results when using the same variable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-102436@lists.php.net to get a copy of this message
ID: 38861 Updated by: iliaa@php.net Reported By: Drezil at web dot de -Status: Assigned +Status: Bogus Bug Type: PDO related Operating System: Debian/Sarge PHP Version: 5.1.6 Assigned To: wez New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You either need to enable buffered queries or disabled native prepare for this to work. Or replace closeCursor() with unset ($qry). The issue is actually a MySQL limitation with buffered queries. Previous Comments: ------------------------------------------------------------------------ [2006-09-17 17:11:54] Drezil at web dot de Description: ------------ with update to php 5.1.6 i ran into problems with the pdo-mysql module (loaded as dyn. extension in the php.ini). If i reuse a variable after retrieving a mysql-result any following result is empty although the query (as shown in the mysql-log) is ommited correctly and has valid results. switching mysql 4.1.15 to mysql 5.0.x or the oter way round doesn't fix anything. Reproduce code: --------------- <?php $user = 'xxx'; $pass = 'xxx'; try { $dbh = new PDO('mysql:host=localhost;dbname=xxx', $user, $pass); $qry = $dbh->query('SELECT 1+1') echo '\''.print($qry->fetch(PDO::FETCH_NUM),true).'\'<br />'; $qry->closeCursor(); $qry = $dbh->query('SELECT 1+1') echo '\''.print($qry->fetch(PDO::FETCH_NUM),true).'\'<br />'; $qry->closeCursor(); $qry = $dbh->query('SELECT 1+1') echo '\''.print($qry->fetch(PDO::FETCH_NUM),true).'\'<br />'; $qry->closeCursor(); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die(); } ?> Expected result: ---------------- '2'<br /> '2'<br /> '2'<br /> Actual result: -------------- '2'<br /> ''<br /> ''<br /> if i just rename the objects to $qry1, $qry2, $qry3 everything works fine and as expected. looks like closeCursor() deosn't work right or the objects are not overwritten correctly. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38861&edit=1

« previous php.bugs (#102436) next »