Advertisement
akas123

Untitled

Jun 24th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2. include '../config/koneksi.php';
  3. $query = mysqli_query($conn, "SELECT * FROM berita");
  4.  
  5. ?>
  6. <!DOCTYPE html>
  7. <html>
  8. <head>
  9. <title>Halaman Administrator</title>
  10. </head>
  11. <style type="text/css">
  12. .berita{
  13. padding: 20px 20px;
  14. }
  15. a button{
  16. text-decoration: none;
  17. background-color: blue;
  18. border-color: blue;
  19. border-radius: 10px;
  20. color: white;
  21. }
  22. a button:hover{
  23. background-color: red;
  24. border-color: red;
  25. border-radius: 10px;
  26. color: black;
  27. }
  28. </style>
  29. <body>
  30. <?php include'menu.php'; ?>
  31. <div class="berita">
  32. <a href="tambah_berita.php"><button>Tambah berita</button></a>
  33. <table border="1" cellpadding="10" cellspacing="0">
  34. <tr>
  35. <th>No.</th>
  36. <th>Gambar</th>
  37. <th>Judul</th>
  38. <th>Konten</th>
  39. <th>Aksi</th>
  40. </tr>
  41. <?php $i=1; ?>
  42. <?php while ($data = mysqli_fetch_array($query)) :?>
  43. <tr>
  44. <td><?= $i; ?></td>
  45. <td><img src="../img/<?= $data['gambar'] ?>"></td>
  46. <td><?= $data['judul'] ?></td>
  47. <td><?= substr($data['konten'],0,40) ?>...</td>
  48. <td>
  49. <a href="edit.php?id=<?= $data['id'] ?>"><button>Edit</button></a> | <a href="hapus.php?id=<?= $data['id'] ?>" onclick='return confirm("Yakin?")'><button>Hapus</button></a>
  50. </td>
  51. </tr>
  52. <?php $i++; ?>
  53. <?php endwhile; ?>
  54. </table>
  55. </div>
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement