Advertisement
cdsatrian

jadwal dokter

May 29th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. //...
  2. switch($_GET[act]){
  3.   // Tampil jadwal_dokter
  4.   default:  
  5. ?>
  6.      <h2>Data Jadwal Dokter</h2>
  7.      <input type=button value='Tambah Jadwal Dokter'
  8.       onclick="window.location.href='?menu=jadwal_dokter&act=tambahjadwaldokter';">
  9.      <table>
  10.        <tr>
  11.          <th></th>
  12.          <th>Senin</th>
  13.          <th>Selasa</th>
  14.          <th>Rabu</th>
  15.          <th>Kamis</th>
  16.          <th>Jumat</th>
  17.          <th>Sabtu</th>
  18.          <th>Minggu</th>
  19.        </tr>
  20. <?php
  21.   $sql="
  22.    SELECT
  23.      waktu,
  24.      IF(hari='SENIN',id_dokter,NULL) AS senin,
  25.      IF(hari='SELASA',id_dokter,NULL) AS selasa,
  26.      IF(hari='RABU',id_dokter,NULL) AS rabu,
  27.      IF(hari='KAMIS',id_dokter,NULL) AS kamis,
  28.      IF(hari='JUMAT',id_dokter,NULL) AS jumat,
  29.      IF(hari='SABTU',id_dokter,NULL) AS sabtu,
  30.      IF(hari='MINGGU',id_dokter,NULL) AS minggu
  31.    FROM jadwal_dokter
  32.    GROUP BY waktu";
  33.   if($tampil=mysql_query($sql)){
  34.     if(mysql_num_rows($tampil)>0){
  35.       while($row=mysql_fetch_object($tampil)){
  36.         echo "
  37.       <tr>
  38.         <td>".$row->waktu."</td>
  39.         <td>".(!empty($row->senin)?$row->senin:'&nbsp;')."</td>
  40.         <td>".(!empty($row->selasa)?$row->selasa:'&nbsp;')."</td>
  41.         <td>".(!empty($row->rabu)?$row->rabu:'&nbsp;')."</td>
  42.         <td>".(!empty($row->kamis)?$row->kamis:'&nbsp;')."</td>
  43.         <td>".(!empty($row->jumat)?$row->jumat:'&nbsp;')."</td>
  44.         <td>".(!$empty($row->sabtu)?$row->sabtu:'&nbsp;')."</td>
  45.         <td>".(!$empty($row->minggu)?$row->minggu:'&nbsp;')."</td>
  46.       </tr>"
  47.       }
  48.     }
  49.   }
  50.   echo "</table>\n";
  51.   break;
  52. //...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement