Using the self-contained function in PHP MSSQL
1. Initializing the stored procedure
$stmt = Mssql_init (' procedure name ');
2. Binding variables
Input parameters:
Mssql_bind ($stmt, ' @operate_flag ', $status, Sqlvarchar); Note that the third argument must be a variable, otherwise an error
Output parameters:
Mssql_bind ($stmt, ' @return_mess ', $output, Sqlvarchar, true); The fifth parameter is whether it is an output marker
Executing stored procedures
$retult = Mssql_execute ($stmt); The second parameter is whether the result set is returned, and the change setting is independent of the return value
Disconnect Connection
Mssql_free_statement ($stmt);
The output value is in the variable $output
When a stored procedure has more than one return result set and a return value, the processing method differs:
Explanations from the PHP maintainer:
Originally we call this method is the PHP 4.3 version is definitely supported before.
"But since php 4.3," They said, "PHP has changed this feature in order to be able to return multiple result sets for a compatible stored procedure. ”
"If you don't need a 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 the result set, you should call Mssql_next_result for each result set." After the last result set is returned, you will get the return value false when you call Mssql_next_result again, and you will be able to access the output parameters.
Modify the code as follows
Mssql_next_result ($result);
http://www.bkjia.com/PHPjc/477903.html www.bkjia.com true http://www.bkjia.com/PHPjc/477903.html techarticle using the self-contained function in PHP MSSQL 1. Initialize the stored procedure $stmt = Mssql_init (procedure name); 2. Binding variable Input parameters: Mssql_bind ($stmt, @operate_flag, $status, Sqlvarch ...