How to remove duplicate row in table : <p>I am new in codeigniter frame work and I am trying to stop duplicate record in my table
In my table record are repeat I want to show one record at one time</p>

<p>This is my code</p>

<p>Controller</p>

<pre><code>  $modelResult = $this-&gt;freightBillModel-&gt;freightBillByDate($data);
  &lt;table id="freight_table" class="table table-bordered table-striped table-sm" style="display:block; overflow: auto; "&gt;
             &lt;tr&gt;
              &lt;th&gt;SR.No&lt;/th&gt;
              &lt;th&gt;Bill No&lt;/th&gt;
              &lt;th&gt;pkgs&lt;/th&gt;
              &lt;th&gt;freight&lt;/th&gt;
             &lt;/tr&gt;
             &lt;tbody&gt;
                &lt;?php  $counter = 1;   ?&gt;
                &lt;?php foreach($modelResult as $freight){?&gt;

            &lt;tr&gt;

              &lt;td&gt;&lt;?php echo $counter;?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $freight['tbb_no'];?&gt;&lt;/td&gt;
              &lt;?php $singleBill = $this-&gt;freightBillModel-&gt;fetchBillByNo($freight['tbb_no']);  ?&gt;
              &lt;?php $lr_freight=0; $no_of_pkgs=0; ?&gt;

              &lt;?php foreach ($singleBill as $bill) : ?&gt;
              &lt;?php $lr_freight+=$bill-&gt;lr_freight; ?&gt;
              &lt;?php $no_of_pkgs+=$bill-&gt;no_of_pkgs; ?&gt;
              &lt;?php endforeach; ?&gt;

              &lt;td&gt;&lt;?php echo $no_of_pkgs;?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $lr_freight;?&gt;&lt;/td&gt;


             &lt;/tr&gt;
            &lt;?php  $counter++; ?&gt;
            &lt;?php }?&gt;
            &lt;/tbody&gt;
          &lt;/table&gt;
</code></pre>

<p>Model:</p>

<pre><code>        public function freightBillByDate($data){
        extract($data);
        $this-&gt;db-&gt;select('bn.branch_name as to,ts_tbb.tbb_no,ts_tbb.tbb_id,ts_tbb.bilty_id,ts_tbb.current_time,ts_tbb.status,b.*');
        $this-&gt;db-&gt;from('ts_tbb');
        $this-&gt;db-&gt;join('bilty b', 'b.id = ts_tbb.bilty_id');

        $this-&gt;db-&gt;join('branch bn', 'b.lr_to=bn.branch_id');

        $this-&gt;db-&gt;where('lr_from',$lr_from);
        $this-&gt;db-&gt;where('lr_to',$lr_to);


        if($bill_type=="pending_bill"){

               $this-&gt;db-&gt;where('billed_status','not_billed');

         }else if($bill_type=="bill_register"){

               $this-&gt;db-&gt;where('billed_status','billed');
         }




        $this-&gt;db-&gt;order_by('lr_date','desc');


        $query=$this-&gt;db-&gt;get();
       return $query-&gt;result_array();

}
function fetchBillByNo($billNo){
    return $this-&gt;db-&gt;select('*')-&gt;from('ts_tbb')-&gt;join('bilty','bilty_id=bilty.id')-&gt;where('tbb_no',$billNo)-&gt;get()-&gt;result();
}[![In this picture first two records are repeat][1]][1]
</code></pre>

<p>I want to show unique records,
Current table it shows duplicate rows
Please tell me where i am wrong in my code</p>
