title: Codeigniter - insert batch - my sql
body: <pre><code> public function insertpricinglist()
    {
     $wholesale = "wholesale";
      $dealer = "dealer";
      $customer = "customer";
  $query = $this-&gt;db-&gt;get_where('products', array('productname' =&gt; $this-&gt;input-&gt;post( 'productname')));
    $row = $query-&gt;result();
    $temp = $row-&gt;id;
  
  for ($i = 1; $i &lt; $this-&gt;input-&gt;post( 'numrows' ); $i++)
  {
  
  $data[] = array(
            'product_id' =&gt; $temp,
            'range'       =&gt; $this-&gt;input-&gt;post( 'range' . $i ),
            'vat@'       =&gt; $this-&gt;input-&gt;post( 'vat' . $i ),
            'price'       =&gt; $this-&gt;input-&gt;post( 'amount' . $i ),
            'uom'      =&gt; $this-&gt;input-&gt;post( 'uom' . $i ),
            'usertype' =&gt; $wholesale
             );
     }
   $this-&gt;db-&gt;insert_batch( 'product_pricing', $data );
  for ($i = 1; $i &lt; $this-&gt;input-&gt;post( 'dealer_numrows' ); $i++)
  {
  
    $data[] = array(
            'product_id' =&gt; $temp,
            'range'       =&gt; $this-&gt;input-&gt;post( 'dealerrange' . $i ),
            'vat@'       =&gt; $this-&gt;input-&gt;post( 'dealervat' . $i ),
            'price'       =&gt; $this-&gt;input-&gt;post( 'dealeramount' . $i ),
            'uom'      =&gt; $this-&gt;input-&gt;post( 'dealeruom' . $i ),
            'usertype' =&gt; $dealer
             );
  }
   $this-&gt;db-&gt;insert_batch( 'product_pricing', $data );
  for ($i = 1; $i &lt; $this-&gt;input-&gt;post( 'customer_numrows' ); $i++)
  {
  
   $data[] = array(
            'product_id' =&gt; $temp,
            'price'       =&gt; $this-&gt;input-&gt;post( 'customer_amount' . $i ),
            'uom'      =&gt; $this-&gt;input-&gt;post( 'customer_uom' . $i ),
            'usertype' =&gt; $customer
             );
  }
   $this-&gt;db-&gt;insert_batch( 'product_pricing', $data );
  }   
  </code></pre>
  
  <p>I am getting an error while trying to insert my batch of datas. I am trying to insert into a product pricing table where wholesale batch and dealer batch and customer batch items are inserted with same product id.</p>
  
  <pre><code>  Error Number: 1064
  
  You have an error in your SQL syntax; check the manual that corresponds to      your MySQL server version for the right syntax to use near 'Array' at line 1
  </code></pre>
  
  <p>//
       Severity: Notice</p>
  
  <pre><code> Message: Trying to get property of non-object
  
  Filename: models/productmodel.php
  
  Line Number: 24
  
    Backtrace:
  
   File: E:\wamp\www\CodeIgniter\application\models\productmodel.php
   Line: 24
  Function: _error_handler
  </code></pre>