title: How to perform a batch update using Codeigniter arrays?
body: <p>Hello guys I just want to ask how can I perform a batch update using arrays in CodeIgniter
  Here's my sample code:</p>
  
  <pre><code> public function updateItemInfo(){
  
          $id = $this-&gt;input-&gt;post('idx'); //array of id
          $desc = $this-&gt;input-&gt;post('itemdesc'); //array of item name
          $qty = $this-&gt;input-&gt;post('qty'); //array or qty
          $price = $this-&gt;input-&gt;post('price'); //array of price
          $code = $this-&gt;input-&gt;post('codes'); // not array
  
          for($x = 0; $x &lt; sizeof($id); $x++){
  
              $total[] = $price[$x] * $qty[$x];
  
              $updateArray = array(
                  'item_desc' =&gt; $desc[$x],
                  'item_qty' =&gt; $qty[$x],
                  'price' =&gt; $price[$x],
                  'total' =&gt; $total
              );
              $this-&gt;db-&gt;where('poid',$id[$x]);
              $this-&gt;db-&gt;update('po_order_details',$updateArray); //Could not update I don't know why
  
          }
  
          //echo "&lt;pre&gt;";
          //print_r($updateArray);
  
  
          $sumoftotal = array_sum($total);
  
          $vat_amt = $sumoftotal / 1.12;
          $vat_input = $vat_amt * 0.12;
          $total_all = $vat_amt + $vat_input;
  
          $updateTotal = array(
              'vatable_input' =&gt; $vat_amt,
              'vatable_amount' =&gt; $vat_input,
              'total_amount_due' =&gt; $total_all
          );
  
          //echo "&lt;pre&gt;";
          //print_r($updateTotal);
  
          //exit;
  
          $this-&gt;db-&gt;where('order_code',$code);
          $this-&gt;db-&gt;update('po_order_total',$updateTotal); //Here also couldn't update
  
      }
  </code></pre>
  
  <p>That's my code And I can't figured it out where's my error. Ia also checked my array values and there's no error in my array. My problem is I can't update my table using batch update.</p>