$user _name = ' Tears of the Dragon '; Declares a variable that is used as the input parameter of a stored procedure
$password = ' 123456 '; Then declare a variable to be used as another input parameter of the stored procedure
$info = "; $info, to accept parameter values from stored procedure output
$host = "192.168.0.1"; Defining the database server
$user = "sa"; Connect User Name
$password = "123456"; Connection password
$DB = "Sample"; Database name
$dblink =mssql_connect ($host, $user, $password) or Die ("can ' t connect to MSSQL"); Connecting to the database server
mssql_select_db ($db, $dblink) or Die ("Can ' t select Sample");//Select Database
$SP = Mssql_init ("test"); Initialize a stored procedure
Add a parameter to the stored procedure, @user_name the parameter name, $user _name the PHP variable that corresponds to the argument, Sqlvarchar indicates that the parameter type is a varchar type of SQL Server, and the first false indicates that the parameter is not an output parameter. That is, the argument is an input parameter, and the second false indicates that the parameter is not allowed to be null, and the last 30 indicates that the variable has a length of 30
Mssql_bind ($SP, "@user_name", $user _name,sqlvarchar,false,false,30);
Mssql_bind ($SP, "@password", $password, sqlvarchar,false,false,30);
Mssql_bind ($SP, "@info", $info, sqlvarchar,true,false,30); Add an output parameter to a stored procedure
Mssql_execute ($SP); Execute the stored procedure
Echo $info; Prints out the output parameter values returned from the stored procedure