maful

data06.php

Mar 11th, 2015
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.31 KB | None | 0 0
  1. <?php
  2. # UNTUK PAGING (PEMBAGIAN HALAMAN)
  3. $row = 20;
  4. $hal = isset($_GET['hal']) ? $_GET['hal'] : 0;
  5. $pageSql = "SELECT * FROM tbl_souvenir";
  6. $pageQry = mysql_query($pageSql, $koneksidb) or die ("error paging: ".mysql_error());
  7. $jml     = mysql_num_rows($pageQry);
  8. $max     = ceil($jml/$row);
  9. ?>
  10. <div class="btn-toolbar list-toolbar">
  11.     <a href="?page=Tambah-Souvenir"><button class="btn btn-primary"><i class="fa fa-plus"></i> Tambah Barang</button></a>
  12.     <div class="btn-group"></div>
  13.     <br>
  14. </div>
  15. <div class="btn-toolbar list-toolbar">
  16.     <form action="?page=Data-Souvenir" method="post" class="form-horizontal" role="form">
  17.     <div class="col-lg-3 col-md-2">
  18.         <input type="text" class="form-control form-cascade-control" name="qcari" value="">
  19.     </div>
  20.         <input type="submit" class="btn btn-primary" name="cari" value="Cari">
  21.     </form>
  22. </div>
  23. <table class="table table-hover table-stripped">
  24.     <thead>
  25.         <tr>
  26.             <th>No</th>
  27.             <th>Nama Barang</th>
  28.             <th>Stok</th>
  29.             <th>Gambar</th>
  30.             <th>&nbsp;</th>
  31.         </tr>
  32.     </thead>
  33.      <?php
  34.         if(isset($_POST['cari'])){
  35.             $qcari=$_POST['qcari'];
  36.             $userSql="SELECT * FROM  tbl_souvenir
  37.             where nm_souvenir like '%$qcari%'";
  38.         }
  39.      
  40.         $userSql = "SELECT * FROM tbl_souvenir ORDER BY nm_souvenir ASC LIMIT $hal, $row";
  41.         $userQry = mysql_query($userSql, $koneksidb)  or die ("Query souvenir salah : ".mysql_error());
  42.         $nomor  = 0;
  43.         while ($userRow = mysql_fetch_array($userQry)) {
  44.         $nomor++;
  45.         $Kode = $userRow['id_souvenir'];
  46.     ?>
  47.     <tbody>
  48.         <tr>
  49.             <td><?php echo $nomor; ?></td>
  50.             <td><?php echo $userRow['nm_souvenir']; ?></td>
  51.             <td><?php echo $userRow['stok']; ?></td>
  52.             <td><a class="fancybox" href='<?php echo $base_url;?>assets/images/souvenir/<?php echo $userRow['gambar']; ?>' title="<?php echo $userRow['ket']; ?>" data-fancybox-group="gallery" >
  53.             <img src="<?php echo $base_url;?>assets/images/souvenir/<?php echo $userRow['gambar']; ?>" width="50" class="img-responsive"></a></td>
  54.             <td><a href="?page=Edit-Souvenir&amp;Kode=<?php echo $Kode; ?>" target="_self" title="Edit Souvenir"><i class="fa fa-pencil"></i></a></td>
  55.         </tr>
  56.     </tbody>
  57.     <?php
  58.         }
  59.     ?>
  60. </table>
  61. <ul class="pagination">
  62. <?php
  63.     for ($h = 1; $h <= $max; $h++) {
  64.         $list[$h] = $row * $h - $row;
  65.         echo " <li><a href='?page=Data-Souvenir&hal=$list[$h]'>$h</a></li> ";
  66.     }
  67. ?>
  68.    
  69. </ul>
Advertisement
Add Comment
Please, Sign In to add comment