Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include '../config/koneksi.php';
- $query = mysqli_query($conn, "SELECT * FROM berita");
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Halaman Administrator</title>
- </head>
- <style type="text/css">
- .berita{
- padding: 20px 20px;
- }
- a button{
- text-decoration: none;
- background-color: blue;
- border-color: blue;
- border-radius: 10px;
- color: white;
- }
- a button:hover{
- background-color: red;
- border-color: red;
- border-radius: 10px;
- color: black;
- }
- </style>
- <body>
- <?php include'menu.php'; ?>
- <div class="berita">
- <a href="tambah_berita.php"><button>Tambah berita</button></a>
- <table border="1" cellpadding="10" cellspacing="0">
- <tr>
- <th>No.</th>
- <th>Gambar</th>
- <th>Judul</th>
- <th>Konten</th>
- <th>Aksi</th>
- </tr>
- <?php $i=1; ?>
- <?php while ($data = mysqli_fetch_array($query)) :?>
- <tr>
- <td><?= $i; ?></td>
- <td><img src="../img/<?= $data['gambar'] ?>"></td>
- <td><?= $data['judul'] ?></td>
- <td><?= substr($data['konten'],0,40) ?>...</td>
- <td>
- <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>
- </td>
- </tr>
- <?php $i++; ?>
- <?php endwhile; ?>
- </table>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement