#30645 [Csd]: getting rowset from a stored procedure, with/without mysqli_realconnect
| From: | georg@php.net | Date: | Mon, 01 Nov 2004 10:09:03 +0000 |
| Subject: | #30645 [Csd]: getting rowset from a stored procedure, with/without mysqli_realconnect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-68580@lists.php.net to get a copy of this message | ||
ID: 30645
Updated by: georg@php.net
Reported By: michael at kofler dot cc
Status: Closed
Bug Type: MySQLi related
Operating System: linux (suse 9.1)
PHP Version: 5CVS-2004-11-01 (dev)
New Comment:
Btw. there is no need to use mysqli_multi_query here - use
mysqli_real_query instead.
Previous Comments:
------------------------------------------------------------------------
[2004-11-01 10:52:33] georg@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2004-11-01 10:05:55] michael at kofler dot cc
Description:
------------
I am using MySQL 5.0.1 (snapshot) and PHP 5.0.2 with mysqli interface
(latest snapshot) under Linux (SUSE 9.1).
I use $mysqli->multi_query to call a SP. I want to get back the SELECT
results of the SP.
With a normal connect ($mysqli = new mysqli($mysqlhost, $mysqluser,
$mysqlpasswd, $mysqldb)), I don't get results.
However, if I instead use $mysqli = mysqli_init +
$mysqli->real_connect() with the very same parameters, everything works
fine (many thanks to Gleb Paharenko for this tip).
Reproduce code:
---------------
This is my SP:
CREATE PROCEDURE
test()
BEGIN
SELECT * FROM t1;
END
And this it the PHP code
$ok = $mysqli->multi_query("CALL test()");
if($ok) {
echo "<p>OK</p>\n";
do {
echo "<p>result</p>\n";
$result = $mysqli->store_result();
if($result) {
show_table($result); // shows result details
$result->close();
}
} while($mysqli->next_result());
}
Expected result:
----------------
With $mysqli->real_connect, the code above works fine.
Actual result:
--------------
With a normal connect ($mysqli = new mysqli(...)), $ok is always false.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30645&edit=1