pagination

parent 8c99ade3
......@@ -2,6 +2,15 @@
require_once("koneksi.php");
include 'header.php';
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");
?>
<!-- breadcrumbs -->
......@@ -71,6 +80,17 @@
<?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>
......
......@@ -2,7 +2,16 @@
require_once("koneksi.php");
include 'header.php';
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 -->
<div class="breadcrumbs">
......@@ -68,7 +77,7 @@
</a>
</div>
<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" />
</div>
</div>
......@@ -79,8 +88,19 @@
<br>
</div>
<?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>
</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