-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduct.php
More file actions
67 lines (60 loc) · 1.57 KB
/
product.php
File metadata and controls
67 lines (60 loc) · 1.57 KB
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
<?php
require_once('config/connect_db.php');
require_once('config/bootstrap.php');
require_once('customer/layouts.php');
session_start();
do_html_head('APP NAME', $bootstrapCSS, $jQueryJS.$bootstrapJS.$fontAwsomeIcons);
do_component_topnav('APP NAME');
?>
<div class="container mt-5">
<div class="row">
<div class="col-12 col-md-2 col-lg-3">
<nav class="nav flex-column bg-white">
<a class="nav-link text-body" href="<?= $_SERVER['PHP_SELF'] ?>">All</a>
<?php
$query = "SELECT DISTINCT prdt_type FROM product";
$result = mysqli_query($conn, $query);
if($result) {
$num_row = mysqli_num_rows($result);
for($i = 0; $i < $num_row; $i++) {
$row = mysqli_fetch_assoc($result);
?>
<a class="nav-link text-body" href="?type=<?= $row['prdt_type'] ?>"><?= strtoupper($row['prdt_type']) ?></a>
<?php
}
}
?>
</nav>
</div>
<div class="col-12 col-md-10 col-lg-9">
<div class="row">
<?php
$query = "SELECT * FROM product";
if(isset($_GET['type'])) {
$category = $_GET['type'];
$query .= " WHERE prdt_type = '$category'";
}
$result = mysqli_query($conn, $query);
if(!$result)
die('Fetch Error');
else {
$num_row = mysqli_num_rows($result);
if($num_row > 0) {
for($i = 0; $i < $num_row; $i++) {
$row = mysqli_fetch_assoc($result);
do_component_product_card($row);
}
} else {
?>
<div class="col-12 text-center">Not have product yet!</div>
<?php
}
}
?>
</div>
</div>
</div>
</div>
<?php
do_html_end();
?>