Advertisement
justhrun

ujian_2.pehape

Aug 20th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.43 KB | None | 0 0
  1. <?php
  2.     if(isset($_GET['id'])){
  3.         $id=$_GET['id'];
  4.         $is_soal = true;
  5.                      
  6. //      $query="select * from tabel_soal where id_matkul='$id'";
  7.         $query = "select a.*, b.matkul, c.angkatan, d.ujian, e.dosen from tabel_soal a
  8.            left join tabel_matkul b   on b.id_matkul = a.id_matkul
  9.            left join tabel_angkatan c on c.id_angkatan = a.id_angkatan
  10.            left join tabel_ujian d    on d.id_ujian = a.id_ujian
  11.            left join tabel_dosen e    on e.nip = a.nip
  12.            where a.id_matkul='$id'";
  13.  
  14.         $result = mysql_query($query);
  15.         $rows = mysql_num_rows($result);
  16.  
  17.         if(!$rows) {  
  18.             echo "<script> document.location.href='./home.php?status=Soal belum dibuat!'; </script>";
  19.         } else {
  20.             $no = 0;
  21.             while( list($id_soal,$pertanyaan,$pilihan_a,$pilihan_b,$pilihan_c,$pilihan_d,$jawaban,$publish,
  22.                 $id_angkatan,$id_ujian,$id_matkul,$nip,$matkul,$angkatan,$ujian,$dosen) = mysql_fetch_row($result) ) {
  23.                 $no++;
  24.                 echo "| $no | $id_soal | $pertanyaan | $pilihan_a | $pilihan_b | $pilihan_c | $pilihan_d | $jawaban | $matkul | $ang
  25. katan | $ujian | $dosen |<br>\n";
  26.             }
  27.             mysql_free_result($result);
  28.             $_SESSION['id_soal']=$id_soal;
  29. // di-off dulu          echo "<script> document.location.href='soal/t_soal.php'; </script>";
  30.         }
  31.  
  32.     }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement