1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
require 'koneksi.php';
include 'common/header.php';
?>
<h1><span class="glyphicon glyphicon-shopping-cart"></span> Daftar Menu </h1>
<br/>
<hr/>
<?php
$per_hal = 8;
$query = "SELECT * from menu";
$jumlah_record = mysqli_query($koneksi, $query);
$jum = mysqli_num_rows($jumlah_record);
$halaman = ceil($jum / $per_hal);
$page = (isset($_GET['page'])) ? (int) $_GET['page'] : 1;
$start = ($page - 1) * $per_hal;
?>
<br/>
<?php
if(isset($_SESSION['username'])){
$id_member = $_SESSION['id_member'];
}
$menu = mysqli_query($GLOBALS["___mysqli_ston"], "select * from menu limit $start, $per_hal");
while ($b = mysqli_fetch_array($menu)) {
?>
<div class="col-md-3">
<a href="detail.php?id=<?php echo $b['id_menu'];?>&id_member=<?php echo $id_member; ?>" class="btn btn-lg btn-buy">
<img src="picture/<?php echo $b['gambar'] ?>" class="img-rounded" width="250" height="250">
<div class="caption">
<h4 style="color: #3c3c3c;"> <?php echo $b['nama']; ?> </h4>
<h4> <b> Rp. <?php echo number_format($b['harga']) ?>,- </b> </h4>
<br/>
</div>
</a>
</div>
<?php
}
?>
<div class="col-md-12">
<ul class="pagination">
<?php
for ($x = 1; $x <= $halaman; $x++) {
?>
<li><a href="?page=<?php echo $x ?>"><?php echo $x ?></a></li>
<?php
}
?>
</ul>
</div>
<?php
include 'common/footer.php';
?>