Php calls the MsSQL stored procedure and uses the built-in RETVAL to obtain the return value during the process _ PHP Tutorial

Source: Internet
Author: User
Php calls the MsSQL stored procedure and uses the built-in RETVAL to obtain the return value in the stored procedure. This article provides a detailed analysis of the php method for calling the MsSQL stored procedure and using the built-in RETVAL to obtain the return value, for more information, see [PHP code]. This article describes how to use the built-in RETVAL to obtain the return value in the MsSQL stored procedure, for more information, see

PHP 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 {
           echo 'EFGH';
}


Stored Procedure]

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

PHP code ]...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.