<table width="100%" border="1" cellspacing="0" cellpadding="1">
  <tbody>
    <tr style="background-color: #E2574C!important; color:white!important;">
      <td style="padding-left:5px;padding-right:7px">No</td>
      <td style="padding-left:5px;padding-right:7px">Customer</td>
      <td style="padding-left:5px;padding-right:7px">Divisi</td>
      <td style="padding-left:5px;padding-right:7px">Kontak</td>
      <td style="padding-left:5px;padding-right:7px">Alamat</td>
      <td style="padding-left:5px;padding-right:7px">Status</td>
    </tr>
    <?php
    $no=1;
    foreach($cust as $pelanggan){
        $divisi=GetAll('master_pelanggan_divisi',array('pelanggan'=>'where/'.$pelanggan['id']))->result_array();
        $div=array();
        $kon=array();
        $i=0;
        foreach($divisi as $divs){
            $div[$i]=$divs['title'];
            
            $kontak=GetAll('master_pelanggan_divisi_kontak',array('divisi'=>'where/'.$divs['id']))->result_array();
            
            foreach($kontak as $kons){
                $div[$i].='<br>';
                $kon[]=$kons['kontak'].' ('.$kons['telp1'].'), ('.$kons['telp2'].')';
            }
            $i++;
        }
        $divisinya=implode('<br/>',$div);
        $kontaknya=implode('<br/>',$kon);
        ?>
    <tr style="background-color: #A9FF96!important;cursor:pointer;">
      <td style="padding-left:5px;padding-right:7px;vertical-align:top"><?php echo $no?></td>
      <td style="padding-left:5px;padding-right:7px;vertical-align:top"><?php echo $pelanggan['title']?></td>
      <td style="padding-left:5px;padding-right:7px;vertical-align:top"><?php echo $divisinya?></td>
      <td style="padding-left:5px;padding-right:7px;vertical-align:top"><?php echo $kontaknya?></td>
      <td style="padding-left:5px;padding-right:7px;vertical-align:top"><?php echo $pelanggan['alamat']?></td>
      <td style="padding-left:5px;padding-right:7px;vertical-align:top"><?php echo $pelanggan['status']?></td>
    </tr><?php $no++; }?>
  </tbody>
</table>


