Advertisement
GWibisono

perbaikannya

Jan 6th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. include('config.php');
  3. include('cek-login.php');
  4. ?>
  5. <style>
  6.     tbody > tr:nth-child(2n+1) > td, tbody > tr:nth-child(2n+1) > th {
  7.         background-color: #CCC;
  8.     }
  9.     table{
  10.  
  11.         margin: auto;
  12.         border-collapse: collapse;
  13.         box-shadow: darkgrey 3px;
  14.     }
  15.     thead tr {
  16.         background-color: #36c2ff;
  17.     }
  18. </style>
  19.  
  20. <?php
  21. if (!empty($_GET['message']) && $_GET['message'] == 'success') {
  22.     echo '<h3>Berhasil meng-update data!</h3>';
  23. } else if (!empty($_GET['message']) && $_GET['message'] == 'delete') {
  24.     echo '<h3>Berhasil menghapus data!</h3>';
  25. }
  26. ?>
  27. <h3>Data Customer</h3>
  28. <table border="1" cellpadding="5" cellspacing="0">
  29.     <thead>
  30.         <tr align="center">
  31.             <td><b>No</b></td>
  32.             <td><b>Customer</b></td>
  33.             <td><b>Pelapor</b></td>
  34.             <td><b>Problem</b></td>
  35.             <td><b>Tanggal Keluhan</b></td>
  36.             <td><b>Tanggapan</b></td>
  37.             <td><b>Tanggal Tanggapan</b></td>
  38.             <td><b>Waktu</b></td>
  39.             <td><b>Status</b></td>
  40.             <td><b>Opsi</b></td>
  41.  
  42.         </tr>
  43.     </thead>
  44.     <tbody>
  45.     <?php
  46. $query = mysql_query("select customer.*, tindakan.*
  47.                      FROM customer LEFT JOIN tindakan
  48.                     ON customer.idcustomer_st=tindakan.idcustomer");
  49.  
  50. $query = mysql_query("select customer.*, tindakan.*, DATEDIFF(tindakan.date,customer.datecustomer) selisih
  51. FROM customer LEFT JOIN tindakan
  52. ON customer.idcustomer_st=tindakan.idcustomer");   
  53.  
  54.  
  55.     $no = 1;
  56.     while ($data = mysql_fetch_array($query)) {
  57.     $datetime1 = new DateTime($row['date']);
  58. $datetime2 = new DateTime($row['datecustomer']);
  59. $interval = $datetime1->diff($datetime2);
  60.  
  61.     ?>
  62.         <tr>
  63.             <td><?php echo $no; ?></td>
  64.             <td><?php echo $data['customer']; ?></td>
  65.             <td><?php echo $data['pelapor']; ?></td>
  66.             <td><?php echo $data['problem']; ?></td>
  67.             <td><?php echo $data['datecustomer']; ?></td>
  68.             <td><?php if(empty($data['tindakan'])){ echo '<span style="color: #f00; ">Belum ada tanggapan</span>'; } else { echo $data['tindakan']; } ?></td>
  69.             <td><?php if(empty($data['date'])){ echo '<span style="color: #f00; ">Belum ada data</span>'; } else { echo $data['date']; } ?></td>
  70.             <td><?php echo $interval->format('%R%a days / %D %H:%I:%S'); ?></td>
  71.            
  72.             <td><?php if(empty($data['selisih'])){ echo '<span style="color:#f00; ">belum</span>';} else echo'<span style="color:#36C; ">selesai</span>';?> </td>
  73.            
  74.             <td>
  75.             <a href="edittanggapan.php?id=<?php echo $data['idcustomer_st']; ?>"><img alt="edit" src="gambar/edit.png" /></a>
  76.             <a href="deletetanggapan.php?id=<?php echo $data['idcustomer_st']; ?>" onclick="return confirm('Anda yakin akan menghapus data?')"><img alt="hapus" src="gambar/hapus.png" /></a>
  77.             </td>
  78.         </tr>
  79.     <?php
  80.     $no++;
  81.     }
  82.     ?>
  83.     </tbody>
  84. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement