I have previously reproduced an article titled php calling mysql stored procedure. After testing, I found that the methods in this article seem to be unavailable!
The PROCEDURE p can't return a result set in the given context error occurs when you call a stored PROCEDURE with a select statement. After google for half a day, I found some comments on the mysql official website. The db_mysql module does not support stored procedure calling. The solution is to use db_mysqli. After testing, you can.
It is easy to use and has nothing to say. copy a piece of code from the Internet:
<? Php
/* Connect to a MySQL server */
$ Link = mysqli_connect (
'Localhost',/* The host to connect */
'Root',/* The user to connect */
'Root',/* The password to use */
'Db _ name');/* The default database to query */
If (! $ Link ){
Printf ("Can't connect to MySQL Server. Errorcode: % s \ n", mysqli_connect_error ());
Exit;
}
/* Send a query to the server */
If ($ result = mysqli_query ($ link, "call se_proc ('crm ')")){
/* Fetch the results of the query */
While ($ row = mysqli_fetch_array ($ result )){
Echo ($ row [0]. "--------- SR.". $ row [1]."
");
}
/* Destroy the result set and free the memory used for it */
Mysqli_free_result ($ result );
}
/* Close the connection */
Mysqli_close ($ link );
?>
What's depressing is that the efficiency of the stored procedure after a long time is not as high as before --