Possible Duplicate:
Can't return a result set in the given context
I am trying to call a basic stored procedure using PHP. But mysql produces an error like "PROCEDURE softland.getAllProducts can't return a result set in the given context".
Stored Procedure
DELIMITER //
CREATE PROCEDURE GetAllProducts()
BEGIN
SELECT * FROM products;
END //
DELIMITER ;
PHP code is
<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("softland",$con);
$id = 1;
$result = mysql_query("call getAllProducts()");
echo $result;
if ($result === FALSE) {
die(mysql_error());
}
while($row=mysql_fetch_array($result)){
echo "<br>".$row['name'];
}
echo "Succees";
?>
Well, this answer is straight from the php page on mysql_connect:
$this->con = mysql_connect($this->h,$this->u,$this->p,false,65536);
Which tells your mysql client to use multi-statement support (see also the mysql client constants: http://php.net/manual/en/mysql.constants.php#mysql.client-flags)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With