How does php obtain mysql stored procedures with returned values and queries?

Source: Internet
Author: User
How does php obtain the stored procedure createprocedurea (outbint) begin & nbsp; select10; & nbsp; setb3; end; PHP $ tsql with returned values returned by mysql. & quot; calla (@ B); & quot; $ tsql. & quot; select @ B; & quot; if ($ m php how to obtain mysql stored procedures with returned values and queries
Stored Procedure
Create procedure a (out B int)
Begin
Select 10;
Set B = 3;
End;

PHP
$ Tsql. = "call a (@ B );";
$ Tsql. = "select @ B ;";
If ($ mysqli-> multi_query ($ tsql )){
If ($ result = $ mysqli-> store_result ()){
While ($ row = $ result-> fetch_array ()){
Array_push ($ data ['table'], $ row );
}
}
If ($ mysqli-> more_results () {// you can determine whether a result set exists.
If ($ mysqli-> next_result ()){
If ($ result = $ mysqli-> store_result ()){
If ($ row = $ result-> fetch_row ()){
For ($ I = 0, $ count = count ($ row); $ I <$ count; $ I ++ ){
$ Data ['output'] [$ I] = $ row [$ I];
}
}
}
}
}
} Else {
Echo "ERROR:", $ mysqli-> errno, "---", $ mysqli-> error;
}
Print_r ($ data ['output']);

There is no way to obtain the return value. if the return value is not included, select B can be used directly, or do not query it in the stored procedure.
If both of them exist, the returned value cannot be obtained.
How can this problem be solved?

------ Solution --------------------
PHP code
   7  8 
  '.$row["title"].'('.$row["page_time"].')'.'';14                 echo $line;15                 printf("\n");16 17         }18         mysql_free_result($result);19 ?>20 21 
   

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.