Want dynamic table row in codeigniter
<p>I am new in codeigniter. I am trying to make a table for product information under a search box in which table row will be increased dynamically from database according to each search by product model number. Now previous search data replaced by new search result and show only one product data but I want to show all previous search result in table row.I tried it by using session but not working. Thanks for any help.  </p>

<pre><code>Model:
class Product_Model extends CI_Model {


  function product_search($model)
    {

        $this-&gt;db-&gt;like('modelno',$model);
        $query  =   $this-&gt;db-&gt;get('alliteam');



        if($query-&gt;num_rows() &gt; 0){

      foreach ($query-&gt;result() as $row)
      {
        $data[] = $row;
      }
      return $data;
    }   


    }
}


Controller:

 public function sell(){
        $this-&gt;load-&gt;library('session');
               $data = array(
            'title' =&gt; 'New Customer',
            'action' =&gt; site_url('Product/sell'),
            'button' =&gt; 'Add Item'
        );

        $model = $this-&gt;input-&gt;post('model',TRUE);

        $data['productinfo'] = $this-&gt;Product_Model-&gt;product_search($model);



    $this-&gt;session-&gt;set_userdata($productinfo);

    $this-&gt;load-&gt;view('customer',$this-&gt;session-&gt;all_userdata());



      }
</code></pre>

<p>View</p>

<pre><code>  &lt;form  action="&lt;?php echo $action;?&gt;" method="post"&gt;
                  &lt;fieldset&gt;
                    &lt;div class="control-group"&gt;

                        &lt;label class="control-label" &gt;Model No :&lt;/label&gt;
                        &lt;div &gt;
                          &lt;input type="text"  name="model" value="" &gt;
                          &lt;span&gt; Enter a product model no&lt;/span&gt;
                        &lt;/div&gt;

                    &lt;div class="form-actions"&gt;

                      &lt;input type="submit"  name="add_item" value="&lt;?php echo $button;?&gt;"/&gt;

                    &lt;/div&gt;
                  &lt;/fieldset&gt;
    &lt;/form&gt;   



                &lt;table &gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th&gt;Name&lt;/th&gt;
                          &lt;th&gt;Model Number&lt;/th&gt;
                          &lt;th&gt;Description&lt;/th&gt;

                      &lt;/tr&gt;
                  &lt;/thead&gt;   
                  &lt;tbody&gt;


                    &lt;?php 
                    if($this-&gt;input-&gt;post('add_item')){
                    foreach($productinfo as $product):?&gt;
                    &lt;tr&gt;

                        &lt;td class="center"&gt;&lt;?php echo $product-&gt;name ?&gt;&lt;/td&gt;&lt;br&gt;                                
                        &lt;td class="center"&gt;&lt;?php echo $product-&gt;modelno ?&gt;&lt;/td&gt;
                        &lt;td class="center"&gt;&lt;?php echo $product-&gt;product_description?&gt;&lt;/td&gt;
                &lt;/tr&gt;
                     &lt;?php endforeach; } ?&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;            
</code></pre>