<?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
$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'];?>" 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';
?>