By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

PHP and MySQL 5 Stored Procedures...

P: n/a
All,
Does anyone have any example code, tutorials, etc. for:
1. Create a basic SP in MySQL 5 (i.e. a simple SP to return all rows)
and
2. Running the SPs from PHP 4.3.7 ?

Thanks.
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
StinkFinger wrote:
Does anyone have any example code, tutorials, etc. for:
1. Create a basic SP in MySQL 5 (i.e. a simple SP to return all rows)
Can't help you with this one. But check out the manual at
http://dev.mysql.com/doc/mysql/en/St...rocedures.html

According to the docs you use "call" with the parameters enclosed in
brackets as at http://dev.mysql.com/doc/mysql/en/CALL.html
2. Running the SPs from PHP 4.3.7 ?


Given that calling an SP is just like calling any piece of SQL, and that you
use "call" to call one as per the manual page above you'd do it like so:

$res = mysql_query("call stored_procedure_name('param1', 'param2')");
while($row = mysql_fetch_assoc($res)) {
...
}

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #2

P: n/a
Thanks - it seems others are having problems also. I was trying to do a
simple experiment, i.e.
select * from table and return everything, however, it doesn't seem so easy.

"Chris Hope" <ch***@electrictoolbox.com> wrote in message
news:10**************@news.athenanews.com...
StinkFinger wrote:
Does anyone have any example code, tutorials, etc. for:
1. Create a basic SP in MySQL 5 (i.e. a simple SP to return all rows)


Can't help you with this one. But check out the manual at
http://dev.mysql.com/doc/mysql/en/St...rocedures.html

According to the docs you use "call" with the parameters enclosed in
brackets as at http://dev.mysql.com/doc/mysql/en/CALL.html
2. Running the SPs from PHP 4.3.7 ?


Given that calling an SP is just like calling any piece of SQL, and that
you
use "call" to call one as per the manual page above you'd do it like so:

$res = mysql_query("call stored_procedure_name('param1', 'param2')");
while($row = mysql_fetch_assoc($res)) {
...
}

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.