title: Codeigniter consecutive queries creates undefined indexes
body: <p>I've been having a problem with consecutive queries. I don't know if CodeIgniter has something to do with it. Can anyone enlighten me if what's going on?</p>
  
  <p>Given:<br/>
  <code>$Attendees</code> is an Array of employee numbers.<br/>
  <code>$data</code> is an Array from a $_POST<br/>
  <code>$data ['quads'.trim($attendees[$i])]</code> - I am trying to attain to get the POST data with an index of <code>quads1234567</code> wherein the numbers is the employee number.</p>
  
  <pre><code>for($i=0; $i &lt; count($attendees)-1; $i++){
  
          $data_update = array(
              'QD'.$data['quads'.trim($attendees[$i])][0].'RTE' =&gt; 3 ,
              'FTRNNG'  =&gt; 'N' ,
          );
  
          $this-&gt;db-&gt;where('TRNSRS', $data['series']); 
          $this-&gt;db-&gt;where('EMPNUM', trim($attendees[$i])); 
          $this-&gt;db-&gt;update('EmployeeSmartsDB', $data_update); 
  
          $data = array(
             'YRSEM'  =&gt; '201301' ,
             'EMPNUM' =&gt; trim($attendees[$i]) ,
             'UNTCDE' =&gt; $data['unitcode'] ,
             'TRNTYP' =&gt; $data['training_type'],
             'TRNSRS' =&gt; $data['series'] ,
             'SKLCDE' =&gt; $data['skillcde'] ,
             'ACTDTE' =&gt; '20130912' ,
             'ACTTME' =&gt; '1534' ,
             'EMPRTE' =&gt; $data['quads'.trim($attendees[$i])][1],
             'QUDRNT' =&gt; $data['quads'.trim($attendees[$i])][0],
             'RMARKS' =&gt; $data['remarks'.trim($attendees[$i])],
          );
  
          $this-&gt;db-&gt;insert('EmployeeLedgerDB', $data); 
  
      }
  </code></pre>
  
  <p>Now, the case is that when I comment out the insert query the whole thing executes flawlessly but once I include the insert query, the index of <code>$data ['quads'.trim($attendees[$i])]</code> is not defined and also the <code>$data['series']</code> index is also not defined. <br><br></p>
  
  <p>All of the errors happens in the update query and not in the insert query. I even tried echoing the values and they disappear when the insert query is uncommented. </p>