pagination

parent 8c99ade3
...@@ -2,6 +2,15 @@ ...@@ -2,6 +2,15 @@
require_once("koneksi.php"); require_once("koneksi.php");
include 'header.php'; include 'header.php';
global $sql; global $sql;
$per_hal = 5;
$jumlah_record = mysqli_query($koneksi, "SELECT * FROM t_artikel");
$no = 1;
$jum = mysqli_num_rows($jumlah_record);
$halaman = ceil($jum / $per_hal);
$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
$start = ($page - 1) * $per_hal;
$sql = mysqli_query($koneksi, "SELECT * FROM t_artikel ORDER BY tanggal_dibuat DESC limit 8"); $sql = mysqli_query($koneksi, "SELECT * FROM t_artikel ORDER BY tanggal_dibuat DESC limit 8");
?> ?>
<!-- breadcrumbs --> <!-- breadcrumbs -->
...@@ -71,6 +80,17 @@ ...@@ -71,6 +80,17 @@
<?php <?php
} }
?> ?>
<nav class="numbering">
<div class="pagination paging">
<?php
for($page=1;$page<=$halaman;$page++){
?>
<li><a href="?page=<?php echo $page ?>"><?php echo $page ?></a></li>
<?php
}
?>
</div>
</nav>
<div class="clearfix"> </div> <div class="clearfix"> </div>
</div> </div>
......
...@@ -2,7 +2,16 @@ ...@@ -2,7 +2,16 @@
require_once("koneksi.php"); require_once("koneksi.php");
include 'header.php'; include 'header.php';
global $sql; global $sql;
$sql = mysqli_query($koneksi, "SELECT * FROM t_buku ORDER BY isbn ASC LIMIT 24");
$per_hal = 12;
$jumlah_record = mysqli_query($koneksi, "SELECT * FROM t_buku");
$no = 1;
$jum = mysqli_num_rows($jumlah_record);
$halaman = ceil($jum / $per_hal);
$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
$start = ($page - 1) * $per_hal;
$sql = mysqli_query($koneksi, "SELECT * FROM t_buku ORDER BY isbn ASC LIMIT $start, $per_hal");
?> ?>
<!-- breadcrumbs --> <!-- breadcrumbs -->
<div class="breadcrumbs"> <div class="breadcrumbs">
...@@ -68,7 +77,7 @@ ...@@ -68,7 +77,7 @@
</a> </a>
</div> </div>
<div class="snipcart-details top_brand_home_details"> <div class="snipcart-details top_brand_home_details">
<a href="function.php?act=add&amp;barang_id=<?php echo $data['isbn']; ?>&amp;ref=checkout.php?kd=<?php echo $data['isbn'];?>"> <a href="function.php?act=add&amp;barang_id=<?php echo $data['isbn']; ?>&amp;ref=checkout.php?kd=<?php echo $data['isbn'];?>" />
<input type="submit" name="simpan" value="Tambah" class="button" /> <input type="submit" name="simpan" value="Tambah" class="button" />
</div> </div>
</div> </div>
...@@ -79,8 +88,19 @@ ...@@ -79,8 +88,19 @@
<br> <br>
</div> </div>
<?php <?php
} }
?> ?>
<nav class="numbering">
<div class="pagination paging">
<?php
for($page=1;$page<=$halaman;$page++){
?>
<li><a href="?page=<?php echo $page ?>"><?php echo $page ?></a></li>
<?php
}
?>
</div>
</nav>
<div class="clearfix"> </div> <div class="clearfix"> </div>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment