Advertisement
2a2

Membuat Tampil Siswa

2a2
Sep 5th, 2018
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.96 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <title>Tampil Data Siswa</title>
  5.   <!--Link Untuk Mempelajari Bootstraps: https://getbootstrap.com/docs/4.1/getting-started/introduction/ dan setelah membuka link ini antum harus cari cari biar ketemu...-->
  6.  
  7.   <!--Bootstraps-->
  8.   <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  9. </head>
  10. <body>
  11.     <div class="container">
  12.       <!--table-responsive, table-responsive-sm-->
  13.       <!--Conntoh Lain Button di bawah ini-->
  14.       <!--<a class="btn btn-primary fixed-bottom" href="insertsiswa.php">Tambah Data</a>-->
  15.       <br>
  16.       <a class="btn btn-primary" href="insertsiswa.php">Tambah Data</a>
  17.       <br>
  18.       <br>
  19.       <table class="table table-striped" border="1">
  20.         <caption>Hak Cipta © Azhar</caption>
  21.         <!--table-bordered, table-hover, table-sm-->
  22.  
  23.           <?php
  24.             include 'koneksi.php';
  25.  
  26.             $sql = "SELECT * FROM tb_siswa";
  27.  
  28.             $tampil_data = $koneksi->query($sql);
  29.  
  30.             if ($tampil_data->num_rows > 0) {
  31.           ?>
  32.  
  33.           <thead class="thead-dark">
  34.             <!--thead-light, thead-->
  35.               <tr>
  36.                 <th>No</th>
  37.                 <th>Nama</th>
  38.                 <th>Alamat</th>
  39.                 <th>Kelas</th>
  40.                 <th>Aksi</th>
  41.               </tr>
  42.           </thead>
  43.           <tbody>
  44.           <?php  
  45.                $no = 1;
  46.                while ($row = $tampil_data->fetch_assoc()) {
  47.                 ?>
  48.                
  49.                
  50.                  <tr>
  51.                     <td><?= $no++ ?></td>
  52.                     <td><?= $row['nama_siswa']?></td>
  53.                     <td><?= $row['alamat_siswa']?></td>
  54.                     <td><?= $row['id_kelas']?></td>
  55.                     <td><a class="btn btn-warning" href="editsiswa.php?id=<?= $row['id_siswa'] ?>">Edit</a>  <a class="btn btn-danger" href="hapussiswa.php?id=<?= $row['id_siswa']?>" onclick="return confirm('Hapus Data ?')">Hapus</a></td>
  56.                </tr>
  57.                
  58.  
  59.                
  60.            <?php }
  61.  
  62.           } else {
  63.             echo "Data Kosong";
  64.           }
  65.           ?>
  66.       </tbody>
  67.  
  68.   </table>
  69. </div>
  70.    
  71.   <!--JQuery-->
  72.   <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  73.  
  74.   <!--JQuery-->
  75.   <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  76.  
  77.   <!--Bootstrap-->
  78.   <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
  79.  
  80. </body>
  81. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement