| | |
PHP 4.3 - Running stored procedures
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 2
Reputation:
Solved Threads: 0
Hi,
I've just discovered mysql stored procedures and have been using PHP4 a few years now, but not as my day job. I can get a mysql stored procedure to execute and work in the PHP script, but I'm having problems executing multiple stored procedures. Each of them returns one recordset.
My connection string looks like this:
A sample of my code that produces the error looks like this:
Now the first recordset works just fine, but when its time to run the second recordset I get a mysql_fetch_row error as below.
If I executed the second procedure on its own that works too.
Do I need to close the recordset before using the next one? How would I do this? I've tried running multiple in line sql SELECT statements and I dont get a problem - its only when I use multiple stored procedures in a page - that this error occurs.
I really would like to start using stored procedures now that I've discovered them so any help in getting around this problem would be great! Thanks.
I've just discovered mysql stored procedures and have been using PHP4 a few years now, but not as my day job. I can get a mysql stored procedure to execute and work in the PHP script, but I'm having problems executing multiple stored procedures. Each of them returns one recordset.
My connection string looks like this:
mysql_connect(hostname,dbname,password,TRUE, 131072); A sample of my code that produces the error looks like this:
PHP Syntax (Toggle Plain Text)
include('connection.php'); $sql = "CALL PlayerListPosition (2, 3, 4);"; $result = mysql_query($sql); while ($rowresult = mysql_fetch_row($result)) { echo "$rowresult[0] <BR />"; } $sql = "CALL PlayerListPosition (2, 1, 1);"; $result = mysql_query($sql); while ($rowresult = mysql_fetch_row($result)) { echo "$rowresult[0] <BR />"; }
Now the first recordset works just fine, but when its time to run the second recordset I get a mysql_fetch_row error as below.
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource If I executed the second procedure on its own that works too.
Do I need to close the recordset before using the next one? How would I do this? I've tried running multiple in line sql SELECT statements and I dont get a problem - its only when I use multiple stored procedures in a page - that this error occurs.
I really would like to start using stored procedures now that I've discovered them so any help in getting around this problem would be great! Thanks.
![]() |
Similar Threads
- Question about inserts (MySQL)
Other Threads in the PHP Forum
- Previous Thread: How to link access with sql??? ='( help me,....
- Next Thread: whois script not working in IE
| Thread Tools | Search this Thread |
301 advanced apache api array autosuggest basics beginner broken cakephp class cms code combobox compression cron curl data database date datepart display dropdownlist dynamic email eregi error execution file files folder form forms function functions google head href htaccess html httppost if...loop image include includingmysecondfileinthechain ip javascript job joomla jquery js key library limit link login md5 menu mlm multiple mysql mysql_real_escape_string oop password paypal pdf pdfdownload php phpvotingscript problem procedure query random screen script search searchbox server session sessions smarty source space sql stored system table traffic tutorial unicode upload url variable video volume votedown web website youtube zend





