Copy codeThe Code is as follows:
Function generateDocCode (){
$ Wf_id = self: WORKFLOW_ID;
$ Doc_code = "";
$ Link = mssql_connect ($ this-> cfg-> db-> params-> host, $ this-> cfg-> db-> params-> username, $ this-> cfg-> db-> params-> password) or die ("Can't connect SQL server ");
Mssql_select_db ($ this-> cfg-> db-> params-> dbname, $ link) or die ("Select database failure ");
$ Stmt = mssql_init ("GenerateDocCode", $ link) or die ("initialize stored procedure failure ");
Mssql_bind ($ stmt, "@ wf_id", $ wf_id, SQLINT4 );
Mssql_bind ($ stmt, "@ doc_code", $ doc_code, SQLVARCHAR, true );
Mssql_execute ($ stmt, false );
// Print "Doc Code is:". $ doc_code;
Return $ doc_code;
}
First, call the mssql_init statement to initialize the stored procedure, then call the mssql_bind statement to specify the stored procedure parameters, and finally call mssql_execute to execute the stored procedure.