Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>SISWA</title>
- <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
- <script type="text/javascript" src="js/jquery.js"></script>
- <script type="text/javascript" src="js/bootstrap.js"></script>
- </head>
- <body>
- <nav class="navbar navbar-expand-md navbar-dark bg-dark">
- <a class="navbar-brand" href="index.php">TABEL SISWA</a>
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
- </button>
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
- <ul class="navbar-nav ml-auto my-1 my-lg-0">
- <li class="nav-item">
- <form class="navbar-form navbar-left">
- <div class="form-group">
- </form>
- </li>
- <li class="nav-item">
- <div class="collapse navbar-collapse" id="navbar Supported Content">
- <form action=""method="post">
- <li class="nav-item">
- <a class="btn btn-danger" href="tambah.php">Tambah</a>
- <button type="submit" name="cari" class="btn btn-danger">Cari</button>
- <input type="search" name="search" class="form-control mr-sm-2" placeholder="cari disini">
- </li>
- </ul>
- </nav>
- <table class="table table-bordered table-striped table-dark">
- <thead class="thead-danger">
- <tr>
- <th><br>NIS</th>
- <th><br>NAMA</th>
- <th><br>JENIS KELAMIN<br></th>
- <th><br>TELEPON</th>
- <th><br>ALAMAT</th>
- <th><br>FOTO</th>
- <th colspan="1">AKSI</th>
- </tr>
- </thead>
- <form>
- <?php
- include "koneksi.php";
- $batas=3;
- $qjum= mysqli_query($koneksi,"SELECT*FROM siswa") or die ($koneksi);
- $jum=mysqli_num_rows($qjum);
- $halaman=ceil($jum/$batas);
- $page=(isset($_GET['page'])) ? $_GET['page']:2;
- $posisi=($page>1) ? ($page*$batas)-$batas:0;
- if(isset($_POST['cari'])){
- $cari=$_POST['search'];
- $result=mysqli_query($koneksi,"SELECT * FROM siswa where Nis like '%".$cari."%' or Nama like'%".$cari."%'");
- }
- else{
- $result=mysqli_query($koneksi,"SELECT * FROM siswa ORDER BY Nis LIMIT 5,5 ");
- }
- while ($data=mysqli_fetch_array($result)){
- echo"<tr>";
- echo"<td>".$data['Nis']."</td>";
- echo"<td>".$data['Nama']."</td>";
- echo"<td>".$data['JenisKelamin']."</td>";
- echo"<td>".$data['telp']."</td>";
- echo"<td>".$data['Alamat']."</td>";
- echo"<td><img src='img/".$data['Foto']."'width='100' height='100'></td>";
- echo"<td><a href='edit.php?Nis=".$data['Nis']."'>Ubah</a></td>";
- echo"<td><a href='hapus.php?Nis=".$data['Nis']."'>Hapus</a></td>";
- }
- ?>
- <div class="paging">
- <?php
- for($x=1; $x<=3; $x++){
- ?>
- <a href="?page=<php echo $x; ?>">
- <?php echo $x; ?>
- <a>
- <?php
- }
- ?>
- </div>
- </form>
- <!-- Optional JavaScript -->
- <!-- jQuery first, then Popper.js, then Bootstrap JS -->
- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment