Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('config.php');
- include('cek-login.php');
- ?>
- <style>
- tbody > tr:nth-child(2n+1) > td, tbody > tr:nth-child(2n+1) > th {
- background-color: #CCC;
- }
- table{
- margin: auto;
- border-collapse: collapse;
- box-shadow: darkgrey 3px;
- }
- thead tr {
- background-color: #36c2ff;
- }
- </style>
- <?php
- if (!empty($_GET['message']) && $_GET['message'] == 'success') {
- echo '<h3>Berhasil meng-update data!</h3>';
- } else if (!empty($_GET['message']) && $_GET['message'] == 'delete') {
- echo '<h3>Berhasil menghapus data!</h3>';
- }
- ?>
- <h3>Data Customer</h3>
- <table border="1" cellpadding="5" cellspacing="0">
- <thead>
- <tr align="center">
- <td><b>No</b></td>
- <td><b>Customer</b></td>
- <td><b>Pelapor</b></td>
- <td><b>Problem</b></td>
- <td><b>Tanggal Keluhan</b></td>
- <td><b>Tanggapan</b></td>
- <td><b>Tanggal Tanggapan</b></td>
- <td><b>Waktu</b></td>
- <td><b>Status</b></td>
- <td><b>Opsi</b></td>
- </tr>
- </thead>
- <tbody>
- <?php
- $query = mysql_query("select customer.*, tindakan.*
- FROM customer LEFT JOIN tindakan
- ON customer.idcustomer_st=tindakan.idcustomer");
- $query = mysql_query("select customer.*, tindakan.*, DATEDIFF(tindakan.date,customer.datecustomer) selisih
- FROM customer LEFT JOIN tindakan
- ON customer.idcustomer_st=tindakan.idcustomer");
- $no = 1;
- while ($data = mysql_fetch_array($query)) {
- $datetime1 = new DateTime($row['date']);
- $datetime2 = new DateTime($row['datecustomer']);
- $interval = $datetime1->diff($datetime2);
- ?>
- <tr>
- <td><?php echo $no; ?></td>
- <td><?php echo $data['customer']; ?></td>
- <td><?php echo $data['pelapor']; ?></td>
- <td><?php echo $data['problem']; ?></td>
- <td><?php echo $data['datecustomer']; ?></td>
- <td><?php if(empty($data['tindakan'])){ echo '<span style="color: #f00; ">Belum ada tanggapan</span>'; } else { echo $data['tindakan']; } ?></td>
- <td><?php if(empty($data['date'])){ echo '<span style="color: #f00; ">Belum ada data</span>'; } else { echo $data['date']; } ?></td>
- <td><?php echo $interval->format('%R%a days / %D %H:%I:%S'); ?></td>
- <td><?php if(empty($data['selisih'])){ echo '<span style="color:#f00; ">belum</span>';} else echo'<span style="color:#36C; ">selesai</span>';?> </td>
- <td>
- <a href="edittanggapan.php?id=<?php echo $data['idcustomer_st']; ?>"><img alt="edit" src="gambar/edit.png" /></a>
- <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>
- </td>
- </tr>
- <?php
- $no++;
- }
- ?>
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement