title: Mysqli multi query error
body: <p>I need to execute two or more queries at a time, fetch them one after another.</p>
  
  <p>Then I need to bind param and bind result in each one of them.</p>
  
  <p>I am trying this way but getting error.</p>
  
  <pre><code>$query="
  SELECT 
  `date`, `ip`, AVG(`value`)
  FROM `stats`.`stats`    
  WHERE `uid`=?
  GROUP BY `date`, `ip`;
  ";
  
  $query.="
  SELECT 
  `category`, `ip`, AVG(`value`)
  FROM `stats`.`stats`    
  WHERE `uid`=?
  GROUP BY `category`, `ip`;
  ";
  
  $prepare = mysqli_multi_query($connection, $query);
  mysqli_stmt_bind_param($prepare, 'ss', $uid,$uid);
  mysqli_stmt_execute($prepare) or trigger_error(mysqli_error($connection), E_USER_ERROR);
  </code></pre>
  
  <p>Then in html part I need to fetch result of these one after another</p>
  
  <pre><code>//fetch first query result
  while (mysqli_stmt_fetch($prepare)):
  mysqli_stmt_store_result($prepare);
  mysqli_stmt_bind_result($prepare, $date,$ip,$value);
  mysqli_free_result($result);
  endwhile;
  
  //fetch second query result
  while (mysqli_next_result($prepare)):
  while (mysqli_stmt_fetch($prepare));
  mysqli_stmt_store_result($prepare);
  mysqli_stmt_bind_result($prepare, $category,$ip,$value);
  mysqli_free_result($result);
  endwhile;
  </code></pre>
  
  <p>But its not working showing multiple errors.</p>
  
  <pre><code> Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in
   Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in
   Fatal error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? GROUP BY `date`,`ip` ) ..
  </code></pre>
  
  <p>Please see and suggest any possible way to do this.</p>
  
  <p>Thanks</p>