| | |
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 |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dropdown dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube





