-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
89 lines (82 loc) · 3.39 KB
/
index.php
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
session_start();
include 'koneksi.php';
// var_dump($_SESSION['user'])
?>
<?php include 'navbar.php'?>
<div id="demo" class="carousel slide" data-ride="carousel">
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="assets/img/WEB1.png" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="assets/img/WEB2.jpg" width="1100" height="500">
</div>
<div class="carousel-item">
<img src="assets/img/WEB3.jpg" width="1100" height="500">
</div>
</div>
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
<!-- content -->
<div class="container mt-3">
<h2>Produk Terbaru</h2>
<div class="row">
<?php $i=1;
$ambil = $koneksi->query("SELECT * FROM produk ORDER BY id_produk DESC ");?>
<?php while($perproduk = $ambil->fetch_assoc()){?>
<?php if($i<=8): ?>
<div class="col-lg-3 col-xs-12 col-sm-6 mb-3">
<div class="card">
<img class="card-img-top" src="foto_produk/<?= $perproduk['foto_produk']?>" alt="Card image cap">
<div class="card-body">
<h5 class="card-title"><a href="detail.php?&id=<?=$perproduk['id_produk']?>"><?= $perproduk['nama_produk']?></a></h5>
<h6 class="card-title">Rp. <?= number_format($perproduk['harga_produk'])?></h6>
<?php if($perproduk['stok_produk']!=='0'):?>
<a href="beli.php?id=<?=$perproduk['id_produk']?>"><button class="btn btn-primary">Beli</button></a>
<a href="detail.php?&id=<?=$perproduk['id_produk']?>" class="btn btn-secondary">Detail</a>
<?php else :?>
<p class="text-danger">Stok Produk Kosong</p>
<?php endif?>
</div>
</div>
</div>
<?php $i++;
endif;
} ?>
</div>
</div>
<!-- content-->
<!-- footer -->
<?php include 'footer.php'; ?>
<!-- end footer -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script>
$(document).ready(function() {
// executes when HTML-Document is loaded and DOM is ready
console.log("document is ready");
$(".card").hover(
function() {
$(this).addClass('shadow-lg').css('cursor', 'pointer');
},
function() {
$(this).removeClass('shadow-lg');
}
);
// document ready
});
</script>
</body>
</html>