title: Can only add one item in cart CODEIGNITER
body: <p>I cant seem to add any more items and the latest one I add replaces the existing one.</p>
  
  <pre><code>public function addcart(){
      if(isset($this-&gt;session-&gt;userdata)){
          $type = $this-&gt;session-&gt;userdata('type');
          $username = $this-&gt;session-&gt;userdata('username');
           $this-&gt;db-&gt;select('id_product ,price');
           $query = $this-&gt;db-&gt;get('product', array('title'=&gt; $this-&gt;input-&gt;post('title')));
  
           if($query-&gt;num_rows() &gt;0){
              $row = $query-&gt;row();
              $data = array(
              'id'     =&gt; $row-&gt;id_product,
             'qty'     =&gt; $this-&gt;input-&gt;post('quantity'),
             'price'   =&gt; $row-&gt;price,
             'name'    =&gt; $this-&gt;input-&gt;post('title'),
             //'options' =&gt; array('Size' =&gt; 'L', 'Color' =&gt; 'Red')
          );
  
          $this-&gt;cart-&gt;insert($data);
          }
      }
  }
  </code></pre>