MySQL seems to start from 5.0 before the introduction of stored procedures, anyway before the application has never touched, but now because the main internal system, so many applications are used to the stored procedures, of course, the front sometimes need to call the MySQL stored procedures, php MySQL Lib seems to support is not very good, however, I searched some information, although not many, but still try to use, now introduce the method, so that the use of friends no longer have a headache.
The MySQL extension is also supported for stored procedures, but it only supports stored procedures that do not return results, and if the stored procedure has output, the call throws an error, and the specific error is forgotten. The invocation method is simple:
$rs = mysql_query ("Call func (' str ')", $conn);
If there is a return result, such as a return string, an error is shown, and the solution I have now found is to use the mysqli extension:
$rs = Mysqli_query ("Call func (' str ')", $conn);
So $rs as a common MySQL result to use, very convenient.
When you call a stored procedure, you may also encounter a problem, that is, you may call multiple stored procedures sequentially, which will also be the error, the solution is to call a stored procedure and processing completed, manually shut down the MySQL link, and then connect again, and then call another stored procedure to process, Number of times the number of stored procedures that need to be invoked is reconnected.