<?php
require 'koneksi.php';
include 'common/header.php';
?>
<h3><span class="glyphicon glyphicon-shopping-cart"></span>  Daftar Menu </h3>
<br/>
<hr/>

<?php
$per_hal = 8;
$jumlah_record = mysql_query("SELECT COUNT(*) from menu");
$jum = mysql_result($jumlah_record, 0);
$halaman = ceil($jum / $per_hal);
$page = (isset($_GET['page'])) ? (int) $_GET['page'] : 1;
$start = ($page - 1) * $per_hal;
?>
<br/>
<?php
$menu = mysql_query("select * from menu limit $start, $per_hal");
while ($b = mysql_fetch_array($menu)) {
    ?>

    <div class="col-md-3">
            <img src="picture/<?php echo $b['gambar'] ?>" class="img-rounded" width="250" height="250">
            <div class="caption">
                <h4 style="color: #2e6da4;"> <?php echo $b['nama']; ?> </h4>
                <h4> <b> <?php echo number_format($b['harga']) ?> </b> </h4>
                <hr/>
                <a href="pesan.php?id=<?php echo $b['id_menu'] ?>" class="btn btn-info"> <span class="glyphicon glyphicon-shopping-cart"></span> Pesan </a>
                <br/> <br/>
            </div>
    </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';
?>