Use the built-in functions in php mssql
1. Initialize the stored procedure
$stmt = mssql_init ( 'procedure name' );
2. Bind variables
Input parameters:
mssql_bind ( $stmt, '@operate_flag', $status, SQLVARCHAR ); Note that the third parameter must be a variable, otherwise an error will be reported
Output parameters:
mssql_bind ( $stmt, '@return_mess', $output, SQLVARCHAR, true ); The fifth parameter is whether it is an output tag
Execute stored procedure
$retult = mssql_execute ( $stmt ); The second parameter is whether to return the result set. Changing the setting has nothing to do with the return value
Disconnect
mssql_free_statement ( $stmt );
The output value is in the variable $output
When the stored procedure has multiple return result sets and return values, the processing method is different:
Explanation from the PHP maintainer:
Originally, our calling method was definitely supported before PHP 4.3.
"However, since PHP version 4.3," they said, "in order to be compatible with stored procedures returning multiple result sets, PHP has changed this feature."
"If you don't need the result set, you should set the second optional parameter of mssql_execute to TRUE so that you can get the output parameters after the mssql_execute method."
"If you need to return result sets, you should call mssql_next_result once for each result set. After the last result set is returned, you will get the return value FALSE by calling mssql_next_result. At this time, you can access the output parameters .
Modify the code as follows
mssql_next_result($result);