Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sql="select a.Anggota_ID id,a.Nama_Anggota nama, count(a.Anggota_ID)c from anggota a, assign a2, bahagian b where a.anggota_id=a2.Anggota_ID and a.bahagian_id=b.bahagian_id
- group by a.Anggota_ID";
- $res=query($sql); //only make query and return result
- $s="<table>";
- while($row=fetch($res))
- {
- $title="<td rowspan='{$row['c']}'>$row[Nama_Anggota]</td>";
- //learn what is 'rowspan'
- $sql="select bahagian from assign a, bahagian b where a.anggota_id=$row[Anggota_ID] and a.bahagian_id=b.bahagian_id";
- $res2=query($sql);
- while($row2=fetch($res2))
- {
- $s.="<tr>".$title;$title='';
- //for every start we need to put the title
- $s.="<td>{$res2['bahagian']}</td>";
- $s.="</tr>";
- }//while($row2=fetch($res2))
- }//while($row=fetch($res))
- $s.="</table>";
- echo $s;$s='';
Advertisement
Add Comment
Please, Sign In to add comment