jagku
asked on
php problems calling stored mysql procudure
Hi Experts,
I have the following code in PHP:
Re mysql, 'myuser' has execute privileges on this procedure - ie if I call this through the mysql console it works. However, when I call this procedure using php it sometimes works and sometimes doesn't. How do I debug (using php) why this isn't being called?
Thanks
I have the following code in PHP:
$mysql = mysql_connect("localhost","myuser","password",false,65536);
mysql_select_db("mydb", $mysql);
$sql = "CALL UPDATE_LINE_ITEMS(123)";
$rs = mysql_query( $sql )
or
die (mysql_errno());
mysql_close($mysql);
Re mysql, 'myuser' has execute privileges on this procedure - ie if I call this through the mysql console it works. However, when I call this procedure using php it sometimes works and sometimes doesn't. How do I debug (using php) why this isn't being called?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
Thanks. I get error 1312.
My procedure doesn't return anything.
Any ideas how I can overcome this?
I thought the 65536 parameter should have fixed this - but it hasn't.
Thanks
Thanks. I get error 1312.
My procedure doesn't return anything.
Any ideas how I can overcome this?
I thought the 65536 parameter should have fixed this - but it hasn't.
Thanks
Try using mysqli, this is an improved interface and should work.
http://uk.php.net/manual/en/mysqli.connect.php
http://uk.php.net/manual/en/mysqli.connect.php
ASKER
Thanks.
I think the problem was that I had a select in the stored procedure that I was using for debugging - which was probably baffling the php-mysql API.
I have commented this out and it seems to be working.
Thanks
I think the problem was that I had a select in the stored procedure that I was using for debugging - which was probably baffling the php-mysql API.
I have commented this out and it seems to be working.
Thanks
Did you get any error code (tru mysql_errno)? Or simply the mysql_query function isn't being called?
Try inserting and ECHO (echo "Line 3:" . $sql;) between lines 3 and 4 to see if that section of code has been reached.