ID: 42548 User updated by: garethjo at usc dot edu Reported By: garethjo at usc dot edu -Status: Feedback +Status: Open Bug Type: MySQLi related Operating System: Windows XP, Windows 2003 PHP Version: 5.2.4 New Comment:
<?php //------------ DATABASE SETUP------------------------ $mysqli = mysqli_init(); $mysqli->real_connect('localhost', 'root', 'root_pass', 'test'); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $strDatabaseCreation = 'CREATE DATABASE IF NOT EXISTS test; USE test; DROP TABLE IF EXISTS `products`; CREATE TABLE `products` ( `intProductId` int(10) unsigned NOT NULL auto_increment, `strProductName` varchar(45) NOT NULL, `douProductPrice` double NOT NULL, `intQuantity` int(10) unsigned NOT NULL, PRIMARY KEY (`intProductId`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `products` (`intProductId`,`strProductName`,`douProductPrice`,`intQuantity`) VALUES (1,\'Mugs\',10,5), (2,\'Boots\',75,12); CREATE PROCEDURE `test`.`spGetProducts`() BEGIN SELECT * FROM Products; END '; printf ("Connection: %s<br>\r\n.", $mysqli->host_info); if($mysqli->multi_query ($strDatabaseCreation)) { print "Databse created successfully<br>\r\n"; } else { print "failed to create database<br>\r\n".$mysqli->error; $mysqli->close(); die; } $mysqli->close(); //------------ BUG TEST START -------------------------- $mysqli = mysqli_init(); $mysqli->real_connect('localhost', 'root', 'root_pass', 'test'); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } if($mysqli->real_query ("CALL spGetProducts();")) { if($objResult = $mysqli->store_result()) { while($row = $objResult->fetch_assoc()) { print $row["strProductName"]." ".$row["strProductName"]."<br>\r\n"; } $objResult->free_result(); } else { print "no results found"; } } else { print $mysqli->error; } $mysqli->close(); ?> Previous Comments: ------------------------------------------------------------------------ [2007-09-04 22:34:09] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2007-09-04 19:24:08] garethjo at usc dot edu Description: ------------ All stored procedure call which would return a result set (and did in the past) produces the error "PROCEDURE procedure.Name can't return a result set in the given context" However the expected results are returned via command line and other mysql clients. Reproduce code: --------------- test code can be found at: http://128.125.64.37/bug.zip Expected result: ---------------- resultset returned Actual result: -------------- PROCEDURE procedure.Name can't return a result set in the given context ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42548&edit=1