endrasgusti

Untitled

Nov 5th, 2017
56
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mysql_select_db($database_ska, $ska);
  2. $query_spc = "SELECT karyawan. nama, karyawan.email, kar_kegiatan.kegiatan
  3. FROM karyawan, kar_kegiatan  where karyawan.nama=kar_kegiatan.nama";
  4. $spc = mysql_query($query_spc, $ska) or die(mysql_error());
  5. //$row_spc = mysql_fetch_assoc($spc);
  6. $totalRows_spc = mysql_num_rows($spc);
  7.  
  8. ?>
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  10. <html xmlns="http://www.w3.org/1999/xhtml">
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  13. <title>Untitled Document</title>
  14. </head>
  15.  
  16. <body>
  17.  
  18.     <p>&nbsp;</p>
  19. <table border="1">
  20. <tr>
  21.     <td>No</td>
  22.     <td>nama</td>
  23.     <td>email</td>
  24.     <td>kegiatan</td>
  25.  </tr>
  26.       <?php
  27.   $i=1;
  28.   $email='';
  29. while($row_spc = mysql_fetch_assoc($spc)) {
  30. if($email!=$row_spc['email']){
  31. echo "<tr>
  32.      <td>".$i."</td>
  33.      <td>".$row_spc['nama']."</td>
  34.      <td>".$row_spc['email']."</td>
  35.      <td>".$row_spc['kegiatan']."</td>
  36.      </tr>";
  37.      $email=$row_spc['email'];
  38.    $i++;
  39.   }
  40.   else {
  41.       echo "<tr>
  42.      <td></td>
  43.      <td></td>
  44.      <td></td>
  45.      <td>".$row_spc['kegiatan']."</td>
  46.      </tr>";
  47.   }
  48. }
  49.   ?>
  50.     </table>
RAW Paste Data