-
Notifications
You must be signed in to change notification settings - Fork 0
/
pencarian.php
59 lines (48 loc) · 1.43 KB
/
pencarian.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
<?php
//error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
session_start();
include 'date.php';
include 'koneksi.php';
$cari = $_GET["cari"];
$semuadata=array();
$ambil = $koneksi->query("SELECT * FROM produk
WHERE nama_produk
LIKE '%$cari%'
OR deskripsi_produk
LIKE '%$cari%'");
while ($pecah = $ambil->fetch_assoc())
{
$semuadata[]=$pecah;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Pencarian</title>
<link rel="stylesheet" type="text/css" href="admin/assets/css/bootstrap.css">
</head>
<body>
<?php include 'navbar.php'; ?>
<div class="container">
<h3>Hasil Pencarian : <?php echo $cari ?></h3>
<?php if (empty($semuadata)): ?>
<div class="alert alert-danger">Produk <strong><?php echo $cari ?></strong> tidak ditemukan.</div>
<?php endif ?>
<div class="row">
<?php foreach ($semuadata as $key => $value): ?>
<div class="col-md-3">
<div class="thumbnail">
<img src="foto_produk/<?php echo $value["foto_produk"]; ?>" class="img-responsive">
<div class="caption">
<h3><?php echo $value["nama_produk"]; ?></h3>
<h5>Rp<?php echo number_format($value["harga_produk"]); ?></h5>
<a href="beli.php?id=<?php echo $value["id_produk"]; ?>" class="btn btn-primary">Beli</a>
<a href="detail.php?id=<?php echo $value["id_produk"]; ?>" class="btn btn-default">Detail</a>
</div>
</div>
</div>
<?php endforeach ?>
</div>
</div>
</body>
</html>