title: mysql insert batch vs. insert loop (codeigniter)
body: <p>kindly enlightened me, which is faster/better approach or just the same between <a href="http://ellislab.com/codeigniter/user-guide/database/active_record.html#insert" rel="nofollow">CI batch insert</a> and loop insert. </p>
  
  <pre><code>$data = array(
            array(
                 'title' =&gt; 'My title' ,
                 'name' =&gt; 'My Name' ,
                 'date' =&gt; 'My date'
            ),
            array(
               'title' =&gt; 'Another title' ,
               'name' =&gt; 'Another Name' ,
               'date' =&gt; 'Another date'
            )
           );
  </code></pre>
  
  <p><br>
  batch insert:</p>
  
  <pre><code>   $this-&gt;db-&gt;insert_batch('mytable', $data); 
  
    /* produces: INSERT INTO mytable (title, name, date) 
            VALUES ('My title', 'My name', 'My date'), 
                   ('Another title', 'Another name', 'Another date'); */
  </code></pre>
  
  <p><br>
  loop insert (php):    </p>
  
  <pre><code> for( $i = 0; $ &lt; count($data); $i++ )
   {
      INSERT INTO mytable (title, name, date) 
      VALUES ($data[$i]['title'], $data[$i]['name'], $data[$i]['date'])
   }
  </code></pre>
  
  <p>thanks!</p>