Home  >  Article  >  Backend Development  >  PHP calls MsSQL stored procedure and uses built-in RETVAL to obtain the return value in the procedure_PHP tutorial

PHP calls MsSQL stored procedure and uses built-in RETVAL to obtain the return value in the procedure_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:16:44793browse

This article is a detailed analysis and introduction to the method of using PHP to call MsSQL stored procedures and using the built-in RETVAL to obtain the return value in the process. Friends who need it can refer to it. ​

[PHP code]

Copy code The code is as follows:
$stmt = mssql_init('P__Global_Test', $conn) or die("initialize stored procedure failure");
mssql_bind($stmt, "RETVAL", $returnValue, SQLINT4, true);
mssql_execute($stmt, false);
           if( $returnValue == 0 ){
echo 'ABCD';
}
            else{
                                                                                                                                                                         ‐           else{ 


【Stored Procedure】

Copy code The code is as follows:


CREATE PROCEDURE dbo.P__User_JudgeResume(
)
set nocount on
set @Message = ''

if not exists( select * from _Test )
begin
Return 0
end
else
begin
Return 1
end
set nocount off
GO

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/372472.htmlTechArticleThis article details the method of using PHP to call MsSQL stored procedures using built-in RETVAL to obtain the return value in the process. Analysis introduction, friends in need can refer to [PHP code] Copy the code...
Statement:
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