gilang05

pagging asw

Oct 17th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.70 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>SISWA</title>
  4.     <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
  5.     <script type="text/javascript" src="js/jquery.js"></script>
  6.     <script type="text/javascript" src="js/bootstrap.js"></script>
  7.  
  8. </head>
  9.     <body>
  10.     <nav class="navbar navbar-expand-md navbar-dark bg-dark">
  11.       <a class="navbar-brand" href="index.php">TABEL SISWA</a>
  12.       <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
  13.       </button>
  14.  
  15.             <div class="collapse navbar-collapse" id="navbarSupportedContent">
  16.               <ul class="navbar-nav ml-auto my-1 my-lg-0">
  17.               <li class="nav-item">
  18.               <form class="navbar-form navbar-left">
  19.               <div class="form-group">
  20.  
  21.         </form>
  22.         </li>
  23.         <li class="nav-item">
  24.         <div class="collapse navbar-collapse" id="navbar Supported Content">
  25.         <form action=""method="post">
  26.         <li class="nav-item">
  27.         <a class="btn btn-danger" href="tambah.php">Tambah</a>
  28.         <button type="submit" name="cari" class="btn btn-danger">Cari</button>
  29.         <input type="search" name="search" class="form-control mr-sm-2" placeholder="cari disini"> 
  30.                   </li>
  31.  
  32. </ul>
  33. </nav>
  34. <table class="table table-bordered table-striped table-dark">
  35. <thead class="thead-danger">
  36. <tr>
  37.             <th><br>NIS</th>
  38.             <th><br>NAMA</th>
  39.             <th><br>JENIS KELAMIN<br></th>
  40.             <th><br>TELEPON</th>
  41.             <th><br>ALAMAT</th>
  42.             <th><br>FOTO</th>
  43.             <th colspan="1">AKSI</th>
  44.         </tr>
  45. </thead>
  46. <form>
  47.     <?php
  48.     include "koneksi.php";
  49.     $batas=3;
  50.     $qjum= mysqli_query($koneksi,"SELECT*FROM siswa") or die ($koneksi);
  51.     $jum=mysqli_num_rows($qjum);
  52.     $halaman=ceil($jum/$batas);
  53.     $page=(isset($_GET['page'])) ? $_GET['page']:2;
  54.     $posisi=($page>1) ? ($page*$batas)-$batas:0;
  55.  
  56.     if(isset($_POST['cari'])){
  57.         $cari=$_POST['search'];
  58.         $result=mysqli_query($koneksi,"SELECT * FROM siswa where Nis like '%".$cari."%' or Nama like'%".$cari."%'");
  59.     }
  60.     else{
  61.         $result=mysqli_query($koneksi,"SELECT * FROM siswa ORDER BY Nis LIMIT 5,5 ");
  62.     }
  63.     while ($data=mysqli_fetch_array($result)){
  64.         echo"<tr>";
  65.  
  66.         echo"<td>".$data['Nis']."</td>";
  67.         echo"<td>".$data['Nama']."</td>";
  68.         echo"<td>".$data['JenisKelamin']."</td>";
  69.         echo"<td>".$data['telp']."</td>";
  70.         echo"<td>".$data['Alamat']."</td>";
  71.         echo"<td><img src='img/".$data['Foto']."'width='100' height='100'></td>";
  72.         echo"<td><a href='edit.php?Nis=".$data['Nis']."'>Ubah</a></td>";
  73.         echo"<td><a href='hapus.php?Nis=".$data['Nis']."'>Hapus</a></td>";
  74.  
  75.     }
  76.    
  77. ?>
  78. <div class="paging">
  79. <?php
  80. for($x=1; $x<=3; $x++){
  81.     ?>
  82.     <a href="?page=<php echo $x; ?>">
  83.     <?php echo $x; ?>
  84.     <a>
  85.     <?php
  86. }
  87. ?>
  88. </div>
  89. </form>
  90.  
  91.     <!-- Optional JavaScript -->
  92.     <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  93.     <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  94.     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
  95.     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  96.   </body>
  97. </html>
Advertisement
Add Comment
Please, Sign In to add comment