Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('config.php');
- require('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 (isset($_GET['message']) && $_GET['message'] == 'success') {
- echo '<h3>Berhasil meng-update data!</h3>';
- } elseif(isset($_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 * from customer");
- //$query = mysql_query("select customer.*, tindakan.*, DATEDIFF(tindakan.date,customer.datecustomer) selisih
- //FROM customer LEFT JOIN tindakan
- //ON customer.idcustomer_st=tindakan.idcustomer");
- $sql="select customer.*, tindakan.*, TIMESTAMPDIFF(tindakan.date,customer.datecustomer) selisih
- FROM customer LEFT JOIN tindakan
- ON customer.idcustomer_st=tindakan.idcustomer";
- $query = mysql_query($sql) or die('error:'.mysql_error()."<br/>".$sql );
- $no = 1;
- while ($data = mysql_fetch_array($query)) {
- ?>
- <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 $data['selisih']; ?></td>
- <td></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