I want to understand what What mysqli_store_result is really? When I visited the mysqli_store_result PHP mysqli_store_result , I found a definition
mysqli_store_result — Transfers a result set from the last query
Question: where does it transfer the result set? Actually, I got the error "Commands out of sync; you can't run this command now" after running mysqli_multi_query But when I used the following method, the error mysqli_multi_query away.
mysqli_multi_query($connection,$query); do { mysqli_store_result($connection); } while(mysqli_next_result($connection));
Now, should I use these mysqli_store_result($connection) and mysqli_next_result($connection) after each mysqli_query or right after mysqli_multi_query since I read in PHP Manaul that
"Although it is always useful to free the memory used by the query result using the mysqli_free_result () function, when transferring large result sets using mysqli_store_result () this becomes especially important."
Source: PHP: mysqli_store_result
Another question arises when I executed the above mysqli_multi_query($connection,$query); , I set the echo 'storing result <br />' operator echo 'storing result <br />' , as shown below
do { echo 'storing result <br /> mysqli_store_result($connection); } while(mysqli_next_result($connection));
Although there were only two INSERT requests in the $ request, but it gave the following output
storing result storing result storing result storing result
This means that four result sets have been transmitted. I can not understand this situation. And the last question. Does the above do while process do while performance?