Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // koneksi
- require_once "koneksi/koneksi.php";
- // query mhs
- $sql_mhs = mysqli_query($con, "SELECT * FROM mahasiswa") or die(mysqli_error($con));
- ?>
- <!doctype html>
- <html lang="id" class="h-100" data-bs-theme="auto">
- <head>
- <!-- kodingan head -->
- </head>
- <body class="d-flex flex-column h-100">
- <!-- header -->
- <!-- Begin page content -->
- <main class="flex-shrink-0 mt-3">
- <div class="container">
- <div class="card">
- <div class="card-header">
- </div>
- <div class="card-body">
- <table class="table table-hover" id="example" style="width:100%">
- <thead class="table-dark text-center">
- </thead>
- <tbody>
- <!-- kodingan ini yang di copy -->
- <?php if (mysqli_num_rows($sql_mhs) > 0) { ?>
- <?php
- $i = 1;
- while ($row = mysqli_fetch_array($sql_mhs)) { ?>
- <tr>
- <th scope="row" class="text-center"><?= $i ?></th>
- <td><?= $row['nama_mahasiswa'] ?></td>
- <td><?= $row['nim'] ?></td>
- <td><?= $row['prodi'] ?></td>
- <td class="text-center">
- <a href="mahasiswa_edit.php?id=<?= $row['id_mahasiswa'] ?>" class="btn btn-outline-primary btn-sm">Edit</a>
- <a href="mahasiswa_hapus.php?id=<?= $row['id_mahasiswa'] ?>" onclick="return confirm('Kamu yakin akan menghapus data ini..?')" class="btn btn-outline-danger btn-sm">Hapus</a>
- </td>
- </tr>
- <?php $i++;
- } ?>
- <?php } ?>
- <!-- stop sampai sini -->
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </main>
- <!-- footer -->
- <!-- link js -->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment