ID: 50416
Updated by: jani@php.net
Reported By: ernesto_vargas at yahoo dot com
-Status: Open
+Status: Feedback
Bug Type: MySQL related
Operating System: Fedora 12
PHP Version: 5.3.1
New Comment:
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
And if that does not work, please provide your configure line.
Previous Comments:
------------------------------------------------------------------------
[2009-12-08 20:28:54] ernesto_vargas at yahoo dot com
Description:
------------
Any call to a mysql stored procedure produces the following error:
"PROCEDURE database.store_proc_name can't return a result set in the
given context"
When calling the stored procedure from mysql cli client do return the
results correctly.
Tested against MySql 5.0 and 5.1.
Work on php-5.2.9 but not on php-5.3.0 or php-5.3.1
Reproduce code:
---------------
DELIMITER $$
CREATE PROCEDURE myproc()
BEGIN
SELECT 'it works!';
END$$
<?php
$link = mysql_connect('127.0.0.1','root','',false,65536);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('test', $link);
if (!$db_selected) {
die ('Can\'t use maxdb : ' . mysql_error());
}
$query = 'CALL myproc();';
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
$row = mysql_fetch_row($result);
var_dump($row);
mysql_free_result($result);
mysql_close($link);
Expected result:
----------------
array(1) {
["it works!"]=>
string(9) "it works!"
}
Actual result:
--------------
Warning: mysql_query(): PROCEDURE test.myproc can't return a result set
in the given context in /home/html/sp_test.php on line 11
Invalid query: PROCEDURE test.myproc can't return a result set in the
given context
Whole query: CALL myproc();
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50416&edit=1