Commands out of sync after executing mysql stored procedure; you can’t run this command now

  question

Php will prompt Commands out of sync when executing sql after calling the stored procedure; What is the problem?

To solve this problem, mysqli’s multi_query method is needed.

<?  Php
 $mysqli = new mysqli("localhost", "root", "sbqcel", "test");
 
 if (mysqli_connect_errno())
 bracket
 Printf("Connect failed: percentage s\n", mysqli_connect_error ());
 exit();
 bracket
 echo 'result1:<br />';
 $mysqli->autocommit(FALSE);
 if ($mysqli->multi_query("call test1();"  ))
 bracket
 do {
 if ($result = $mysqli->store_result()) {
 while ($row = $result->fetch_row()) {
 Printf ("percentage s\n", $row[0]);
 bracket
 $result->close();
 bracket
 } while ($mysqli->next_result());
 bracket
 $mysqli->commit();
 echo "<br />";
 echo "result2:<br />";
 if ($result2 = $mysqli->query("select val from tb1;"  ))
 bracket
 while ($row = $result2->fetch_row()) {
 Printf ("percentage s <br />", $row[0]);
 bracket
 $result2->close();
 bracket
 Else
 bracket
 echo $mysqli->error;
 bracket
 $mysqli->close();
 ?  >