title: Possible to use multiple/nested MySQLi statements?
body: <p>Is it possible to have a <code>MySQLi prepared statement</code> within the <code>fetch()</code> call of a previous statement? If not, what's the best way around it?</p>
  
  <p>Example code:</p>
  
  <pre><code>if($stmt = $link-&gt;prepare("SELECT item FROM data WHERE id = ?")) {
      $stmt-&gt;bind_param("i", $id);
      $stmt-&gt;execute();
      $stmt-&gt;bind_result($item);
      while( $stmt-&gt;fetch() ) {
          /* Other code here */
          $itemSummary = $item + $magic;
          if($stmt2 = $link-&gt;prepare("INSERT INTO summaries (itemID, summary) VALUES (?, ?)")) {
              $stmt2-&gt;bind_param("is", $itemID, $itemSummary);
              $stmt2-&gt;execute();
              $stmt2-&gt;close();
          }
      }
  }
  </code></pre>