sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
cieletmer's Avatar

communicating with mysql5 stored procedures


Question posted by: cieletmer (Guest) on November 9th, 2005 05:15 PM
Greetings!

Does anyone have examples on how to interact with mysql5 stored
procedures from php?

I have a stored procedure sp_get_values() with last line

SELECT v_computed_value1 AS cv1, v_computed_value2 AS CV2 ;

When I try to call this from php with the lines:

$sql = "CALL sp_get_values()" ;
$query_result = mysql_query($sql, $connection) ;

the return value of mysql_query is FALSE and I can't do anything with
the mysql_fetch_* functions.

The SQL-Statement

CALL sp_get_values()

works fine with mysql directly and returns the expected 1 row with 2
columns cv1 and cv2.

While we're on the topic, examples of accessing mysql's OUT parameters
from PHP would also be great.

Many thanks!

4 Answers Posted
Justin Koivisto's Avatar
Justin Koivisto November 9th, 2005 05:15 PM
Guest - n/a Posts
#2: Re: communicating with mysql5 stored procedures

cieletmer wrote:[color=blue]
> Greetings!
>
> Does anyone have examples on how to interact with mysql5 stored
> procedures from php?
>
> I have a stored procedure sp_get_values() with last line
>
> SELECT v_computed_value1 AS cv1, v_computed_value2 AS CV2 ;
>
> When I try to call this from php with the lines:
>
> $sql = "CALL sp_get_values()" ;
> $query_result = mysql_query($sql, $connection) ;
>
> the return value of mysql_query is FALSE and I can't do anything with
> the mysql_fetch_* functions.
>
> The SQL-Statement
>
> CALL sp_get_values()
>
> works fine with mysql directly and returns the expected 1 row with 2
> columns cv1 and cv2.
>
> While we're on the topic, examples of accessing mysql's OUT parameters
> from PHP would also be great.
>
> Many thanks!
>[/color]

You need to use the "MySQL Improved Extension" for features of mysql 4.1
and above...

http://us3.php.net/mysqli

--
Justin Koivisto, ZCE - Join Bytes!
http://koivi.com
cieletmer's Avatar
Guest - n/a Posts
#3: Re: communicating with mysql5 stored procedures

Thanks, Justin!

Ciao,

Ciel&Mer

Kevin Newman's Avatar
Guest - n/a Posts
#4: Re: communicating with mysql5 stored procedures

Justin Koivisto wrote:[color=blue]
> You need to use the "MySQL Improved Extension" for features of mysql 4.1
> and above...
>
> http://us3.php.net/mysqli
>[/color]

Or PDO?

http://us3.php.net/pdo

Kevin N.
Justin Koivisto's Avatar
Guest - n/a Posts
#5: Re: communicating with mysql5 stored procedures

Kevin Newman wrote:[color=blue]
> Justin Koivisto wrote:
>[color=green]
>> You need to use the "MySQL Improved Extension" for features of mysql
>> 4.1 and above...
>>
>> http://us3.php.net/mysqli
>>[/color]
>
> Or PDO?
>
> http://us3.php.net/pdo[/color]

Which is a pear library & uses mysqli - IINM

--
Justin Koivisto, ZCE - Join Bytes!
http://koivi.com
 
Not the answer you were looking for? Post your question . . .
196,808 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,808 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors