PHP calls MS SQL stored procedure

巴扎黑
Release: 2016-11-10 11:00:12
Original
1037 people have browsed it

Calling MS SQL stored procedures in PHP

functiongenerateDocCode(){
$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)ordie("Can'tconnectsqlserver");
mssql_select_db($this->cfg->db->params->dbname,$link)ordie("Selectdatabasefailure");
$stmt=mssql_init("GenerateDocCode",$link)ordie("initializestoredprocedurefailure");
mssql_bind($stmt,"@wf_id",$wf_id,SQLINT4);
mssql_bind($stmt,"@doc_code",$doc_code,SQLVARCHAR,true);
mssql_execute($stmt,false);
//print"DocCodeis:".$doc_code;
return$doc_code;
}
Copy after login

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.


Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template