humaidi

modifikasi halaman mahasiswa.php

Oct 28th, 2023 (edited)
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.33 KB | Source Code | 0 0
  1. <?php
  2.  
  3. // koneksi
  4. require_once "koneksi/koneksi.php";
  5.  
  6. // query mhs
  7. $sql_mhs = mysqli_query($con, "SELECT * FROM mahasiswa") or die(mysqli_error($con));
  8.  
  9. ?>
  10.  
  11. <!doctype html>
  12. <html lang="id" class="h-100" data-bs-theme="auto">
  13.  
  14. <head>
  15.  
  16.     <!-- kodingan head -->
  17.  
  18. </head>
  19.  
  20. <body class="d-flex flex-column h-100">
  21.  
  22.     <!-- header -->
  23.  
  24.     <!-- Begin page content -->
  25.     <main class="flex-shrink-0 mt-3">
  26.         <div class="container">
  27.  
  28.  
  29.             <div class="card">
  30.                 <div class="card-header">
  31.  
  32.                 </div>
  33.  
  34.                 <div class="card-body">
  35.                     <table class="table table-hover" id="example" style="width:100%">
  36.                         <thead class="table-dark text-center">
  37.  
  38.                         </thead>
  39.                         <tbody>
  40.  
  41.                         <!-- kodingan ini yang di copy -->
  42.                             <?php if (mysqli_num_rows($sql_mhs) > 0) { ?>
  43.                                 <?php
  44.                                 $i = 1;
  45.                                 while ($row = mysqli_fetch_array($sql_mhs)) { ?>
  46.  
  47.                                     <tr>
  48.                                         <th scope="row" class="text-center"><?= $i ?></th>
  49.                                         <td><?= $row['nama_mahasiswa'] ?></td>
  50.                                         <td><?= $row['nim'] ?></td>
  51.                                         <td><?= $row['prodi'] ?></td>
  52.                                         <td class="text-center">
  53.                                             <a href="mahasiswa_edit.php?id=<?= $row['id_mahasiswa'] ?>" class="btn btn-outline-primary btn-sm">Edit</a>
  54.                                             <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>
  55.                                         </td>
  56.                                     </tr>
  57.  
  58.                                 <?php $i++;
  59.                                 } ?>
  60.                             <?php } ?>
  61.  
  62.                             <!-- stop sampai sini -->
  63.  
  64.  
  65.                         </tbody>
  66.                     </table>
  67.                 </div>
  68.             </div>
  69.  
  70.         </div>
  71.     </main>
  72.  
  73.     <!-- footer -->
  74.  
  75.  
  76.     <!-- link js -->
  77.  
  78. </body>
  79.  
  80. </html>
Advertisement
Add Comment
Please, Sign In to add comment