Advertisement
gilang05

pagging

Oct 17th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1. <table class="table table-bordered table-striped table-dark">
  2. <thead class="thead-danger">
  3.             <th><br>NIS</th>
  4.             <th><br>NAMA</th>
  5.             <th><br>JENIS KELAMIN<br></th>
  6.             <th><br>TELEPON</th>
  7.             <th><br>ALAMAT</th>
  8.             <th><br>FOTO</th>
  9.             <th colspan="1">AKSI</th>
  10.         </tr>
  11. </thead>
  12.     <?php
  13.     include "koneksi.php";
  14.     $batas=3;
  15.     $qjum= mysqli_query($koneksi,"SELECT*FROM siswa") or die ($koneksi);
  16.     $jum=mysqli_num_rows($qjum);
  17.     $halaman=ceil($jum/$batas);
  18.     $page=(isset($_GET['page'])) ? $_GET['page']:1;
  19.     $posisi=($page-1)* $batas;
  20.  
  21.     if(isset($_POST['cari'])){
  22.         $cari=$_POST['search'];
  23.         $result=mysqli_query($koneksi,"SELECT * FROM siswa where Nis like '%".$cari."%' or Nama like'%".$cari."%'");
  24.     }
  25.     else{
  26.         $result=mysqli_query($koneksi,"SELECT * FROM siswa LIMIT $posisi $batas") or die($koneksi);
  27.     }
  28.     while ($data=mysqli_fetch_array($result)){
  29.         echo"<tr>";
  30.  
  31.         echo"<td>".$data['Nis']."</td>";
  32.         echo"<td>".$data['Nama']."</td>";
  33.         echo"<td>".$data['JenisKelamin']."</td>";
  34.         echo"<td>".$data['telp']."</td>";
  35.         echo"<td>".$data['Alamat']."</td>";
  36.         echo"<td><img src='img/".$data['Foto']."'width='100' height='100'></td>";
  37.         echo"<td><a href='edit.php?Nis=".$data['Nis']."'>Ubah</a></td>";
  38.         echo"<td><a href='hapus.php?Nis=".$data['Nis']."'>Hapus</a></td>";
  39.  
  40.     }
  41.    
  42. ?>
  43. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement