MySQL Forums
Forum List  »  PHP

How do you call a stored procedure from PHP ...
Posted by: Paul Pikowsky
Date: March 01, 2006 01:24PM

... and how do you use the results? If I create a stored procedure:

CREATE PROCEDURE `ProcedureTEST`()
Begin
SELECT * FROM My_Table;
End $$

And I try and retrieve it with

"mysql_query('Call ProcedureTEST', $MyConnection) or die(mysql_error());"

I get an error,

"PROCEDURE MySchema.ProcedureTEST can't return a result set in the given context"

I've tried removing the "or die ..." option and I still can't find any evidence that the procedure was called. The new and excellent book from Apress, "MySQL 5" suggest that it can be done, but it uses mysqli classes to do it and that is brand new to me. It also looks like there is not much difference between a mysqli query call and the above query.

What am I missing? How are stored procedures and functions made useful for PHP?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.