如何在php codeigniter中只显示一次数据

My task is i want to display Sno,bill date,bill no partyname,item name,Qty,Amoumt,Disc %,DiscAmt and bill amount..all other columns are present in purchase bill array except itemname and i want to display itemname according to their bill no, my problem is all the columns are repeatedly printing according to the itemname...but i want to display itemname according to the items in one column and all other columns in one row..enter image description hereController code:

    if($this->input->post('selected'))
    {
        if($name = $this->input->post('businessType'))
        {
            $this->db->where('date >=', $newDate);
            $this->db->where('date <=', $newDate2);
            $this->db->where('PName',$name);
            $this->db->select('*');
            $this->db->from('purchaseitem');
            $this->db->order_by("billno", "asc");
            $this->db->join('purchasebill', 'purchasebill.no = purchaseitem.billno','left outer');
            $this->db->join('parmaster','parmaster.Pcode = purchasebill.partyname','left outer');
            $query = $this->db->get('')->result_array();
            $data['query'] = $query;
            $this->load->view('Receipt_View', $data);
         }
    }

View page code:

    <th>Bill No</th>
    <th>Bill Date</th>
    <th>Party Name</th>
    <th>Item Name</th>
    <th>Qty</th>
    <th>Amount</th>
    <th>Disc %</th>
    <th>Disc Amt</th>
    <th>Bill Amount</th>
    <!--<th>Bill Amount</th>-->
</tr>
</thead>
<br>
<tbody>
<?php $rowcount = 1 ?>                          
<?php foreach($query as $row): ?>
    <tr>
        <td><?=$rowcount;?></td>
        <td><?=$row['no'];?></td>
        <td><?=$row['date'];?></td>
        <td><?=$row['PName'];?></td>
        <td><?=$row['Prdtname'];?></td>
        <td><?=$row['Qty'];?></td>
        <td><?=$row['amount'];?></td>
        <td><?=$row['Disper'];?></td>
        <td><?=$row['Disamt'];?></td>
        <td><?=$row['Grdtot'];?></td>
  <?php $rowcount +=1 ?>
  <?php endforeach ?>

<br>
    </tr>