Like what
$db->query ("SET NAMES UTF8");
if ($db->real_query ("Call Sp_test ()")) {
do{
Echo ' BP ';
if ($result = $db->store_result ()) {
while ($row = $result->fetch_assoc ()) {
Array_push ($rows, $row);
}
$result->close ();
}
}while ($db->next_result ());
}
$db->close ();
You will find that assuming you return 1 result sets, you will hit 2 bp,2 result sets will echo out 3 BP, but if not write storage, directly write statements, it is normal, will not be more than one, ask the big God guidance Maze!
Reply to discussion (solution)
Isn't that normal? Otherwise you want if ($result = $db->store_result ()) {What do you do?
Isn't that normal? Otherwise you want if ($result = $db->store_result ()) {What do you do?
Hello, but the direct write statement in PHP will not be more than one, such as select 1;select 2;
He hit 2 BP, which is why, in the stored procedure also write the above 2 sentences will be out of 3
PHP database functions do not support shapes such as select 1;select 2; Such a query, and therefore cannot be used as a reference frame
do{ if ($result = $db->store_result ()) { } }while ($db->next_result ());
Such a code structure is required to read the stored procedure result set, if you think it is a bug, you can go to the PHP bug website to complain.
But you still have to do it before you fix it.
PHP database functions do not support shapes such as select 1;select 2; Such a query, and therefore cannot be used as a reference frame
do{ if ($result = $db->store_result ()) { } }while ($db->next_result ());
Such a code structure is required to read the stored procedure result set, if you think it is a bug, you can go to the PHP bug website to complain.
But you still have to do it before you fix it.
Thank you so much
Because your echo is written in front of the IF ($result = $db->store_result ()) {, and there is no result to see if ($result = $db->store_result ()) {The result of the judgment is not known, So there must be 2 results when, if to judge 3 times, that is, you say 3 times BP
In fact, simply put, your confusion lies in
$i = 1; $max = 2;while (true) {echo "A";//This will definitely output 3 AIF ($i > $max) {break ;} $i + +;}
PHP database functions do not support shapes such as select 1;select 2; Such a query, and therefore cannot be used as a reference frame
do{ if ($result = $db->store_result ()) { } }while ($db->next_result ());
Such a code structure is required to read the stored procedure result set, if you think it is a bug, you can go to the PHP bug website to complain.
But you still have to do it before you fix it.
Hero, I am sorry, I also want to ask, $result = $db->store_result (), this sentence exactly what meaning, this is the assignment operation, how can return bool value?
$db->store_result () returns a query result resource
When it is gone, the return is empty (null)
$db->store_result () returns a query result resource
When it is gone, the return is empty (null)
That $result =null This return is false?
It's true that an assignment expression can return false,php.
Is I understand wrong, shipped to if inside judge is only $result value!!