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