How does PHP get the output parameters of the MSSQL stored procedure? _php Tutorials

Source: Internet
Author: User
Using the self-contained function in PHP MSSQL
1. Initializing the stored procedure
$stmt = Mssql_init (' procedure name ');
2. Binding variables
Input parameters:
Mssql_bind ($stmt, ' @operate_flag ', $status, Sqlvarchar); Note that the third argument must be a variable, otherwise an error
Output parameters:
Mssql_bind ($stmt, ' @return_mess ', $output, Sqlvarchar, true); The fifth parameter is whether it is an output marker
Executing stored procedures
$retult = Mssql_execute ($stmt); The second parameter is whether the result set is returned, and the change setting is independent of the return value
Disconnect Connection
Mssql_free_statement ($stmt);
The output value is in the variable $output

When a stored procedure has more than one return result set and a return value, the processing method differs:
Explanations from the PHP maintainer:
Originally we call this method is the PHP 4.3 version is definitely supported before.
"But since php 4.3," They said, "PHP has changed this feature in order to be able to return multiple result sets for a compatible stored procedure. ”
"If you don't need a result set, you should set the second optional parameter of Mssql_execute to true, so that you can get the output parameters after the Mssql_execute method." ”
"If you need to return the result set, you should call Mssql_next_result for each result set." After the last result set is returned, you will get the return value false when you call Mssql_next_result again, and you will be able to access the output parameters.
Modify the code as follows
Mssql_next_result ($result);

http://www.bkjia.com/PHPjc/477903.html www.bkjia.com true http://www.bkjia.com/PHPjc/477903.html techarticle using the self-contained function in PHP MSSQL 1. Initialize the stored procedure $stmt = Mssql_init (procedure name); 2. Binding variable Input parameters: Mssql_bind ($stmt, @operate_flag, $status, Sqlvarch ...

  • 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.