title: PHP/mysqli - prepared statement (in a loop) or multi_query
body: <p>I've just moved on from using mysql to mysqli extension in PHP.</p>
  
  <p>I've come across two ways of doing the same thing (multiple update queries), what are the pros/cons of each? Should I be using one or the other or something else entirely?</p>
  
  <p>Prepared statement in a loop:</p>
  
  <pre><code>//prepare statement
  foreach(whatever){
    //execute statement
  }
  </code></pre>
  
  <p>or</p>
  
  <p>Multi-query:</p>
  
  <pre><code>foreach(whatever){
    //build many queries into a single string
  }
  multi_query(long string)
  </code></pre>
  
  <p>I know that prepared statements offer better security.
  When using mysql in PHP I've heard its best to avoid using UPDATE statements in a loop - isn't executing a mysqli prepared statement in a loop the same thing by another name?</p>