Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- tr.style15 th {border:solid 1px #000000;background-color:#66CCCC}
- tr.style8 td {border:solid 1px #000000;}
- .center {text-align:center}
- </style>
- <table width="766" border="1" cellspacing="1" cellpadding="1">
- <thead>
- <tr class="style15">
- <th width="25">No</th>
- <th width="50">Hari </th>
- <th>Jam</th>
- <th width="302">Matakuliah</th>
- <th width="30">SKS</th>
- <th width="130">Dosen Pengajar</th>
- <th width="150">Ruang</th>
- </tr>
- </thead>
- <tbody>
- <?php
- include "koneksi.php";
- $semester = $_GET['semester'];
- $sql="SELECT
- a.hari,
- b.namadosen,
- c.jammengajar,
- d.namamk,
- d.sks,
- e.namaruang
- FROM
- tbljadwal a
- JOIN tbldosen b USING(kodedosen)
- JOIN tblwaktu c USING(koderuang)
- JOIN tblmatakuliah d USING(kodemk)
- JOIN tblruang e USING(koderuang)
- WHERE
- a.tingkatsemester = '".$_GET['angka']."'";
- $result = mysql_query($sql);
- $records=array();
- while($r=mysql_fetch_array($result))
- {
- if(isset($records[$r['hari']]))
- {
- $records[$r['hari']]=array();
- $records[$r['hari']]['num']=1;
- $records[$r['hari']]['data']=array();
- $records[$r['hari']]['data'][]=$r;
- }
- else
- {
- $records[$r['hari']]['data'][]=$r;
- $records[$r['hari']]['num']++;
- }
- }
- $no=0;
- foreach($records as $record)
- {
- $jml=0;
- foreach($record['data'] as $row)
- {
- echo "
- <tr class='style8'>
- <td>".++$no."</td>"
- .(++$jml==1?($record['num']==1?"<td>".$row['hari']."</td>":"<td rowspan='".$record['num'].">".$row['hari']."</td>"):"")
- ."<td>".$row['jammengajar']."</td>
- <td>".$row['namamk']."</td>
- <td class='center'>".$row['sks']."</td>
- <td class='center'>".$row['namadosen']."</td>
- <td class='center'>".$row['namaruangan']."</td>
- </tr>
- ";
- }
- }
- ?>
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement