title: PHP: «Commands out of sync» if I mysqli::query() again after a call to a results-giving stored procedure
body: <p>I have a stored procedure in my db that returns all records in a table:</p>
  
  <pre><code>CREATE PROCEDURE showAll()
  BEGIN
      SELECT * FROM myTable;
  END
  </code></pre>
  
  <p>The SP works just as expected. But, if I call it in a php script and then I try to query the database again, it always fail:</p>
  
  <pre><code>// $mysqli is a db connection
  
  // first query:
  
  if (!$t = $mysqli-&gt;query("call showAll()"))
      die('Error in the 1st query');
  
  while ($r = $t-&gt;fetch_row()) {
      echo $r[0] . "&lt;br&gt;"; // this is ok
  }
  
  $t-&gt;free(); // EDIT (this doesn't help anyway)
  
  // second query (does the same thing):
  
  if (!$t = $mysqli-&gt;query("SELECT * from myTable"))
      die('Error in the 2nd query'); // I always get this error
  
  while ($r = $t-&gt;fetch_row()) {
      echo $r[0] . "&lt;br&gt;";
  }
  </code></pre>
  
  <p>Notable, if I swap the two queries (i.e. I call the stored procedure at the end) it works without any error. To close() the result before the second query doesn't help.
  Some hints?</p>
  
  <p>EDIT: mysqli::error() is: «Commands out of sync; you can't run this command now».</p>