Home  >  Article  >  php教程  >  解析:php调用MsSQL存储过程使用内置RETVAL获取过程中的return值

解析:php调用MsSQL存储过程使用内置RETVAL获取过程中的return值

WBOY
WBOYOriginal
2016-06-13 11:43:281227browse

【PHP代码】

复制代码 代码如下:


 $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{

           echo 'EFGH';


【存储过程】

复制代码 代码如下:


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


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