title: Can you use mysqli prepared statements and transactions together?
body: <p>All I want to know is if you can use mysqli's <code>prepare</code>, <code>execute</code>, and <code>rollback</code> together?</p>
  <pre><code>$m = new mysqli($dbhost,$dbuser,$dbpassword,$dbname);
  
  $m-&gt;autocommit(FALSE);
  $stmt = $m-&gt;prepare(&quot;INSERT `table` (`name`,`gender`,`age`) VALUES (?,?,?)&quot;);
  $stmt-&gt;bind_param(&quot;ssi&quot;, $name, $gender, $age);
  $query_ok = $stmt-&gt;execute();
  
  $stmt = $m-&gt;prepare(&quot;INSERT `table` (`name`,`gender`,`age`) VALUES (?,?,?)&quot;);
  $stmt-&gt;bind_param(&quot;ssi&quot;, $name, $gender, $age);
  if ($query_ok) {$query_ok = $stmt-&gt;execute();}
  
  if (!$query_ok) {$m-&gt;rollback();} else {$m-&gt;commit();}
  </code></pre>
  <p>Can you do this?  Let's assume that the above code has a loop and or the variables get new data in them.</p>