-
Notifications
You must be signed in to change notification settings - Fork 0
/
products.php
executable file
·38 lines (38 loc) · 1.61 KB
/
products.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
<?php
include('admin/config.php');
include('common.html.php');
$category = $_GET['c'];
$subcategory = $_GET['sc'];
$query = "SELECT id, name, img, price, info FROM products where category ='".$category."' and subcategory = '".$subcategory."'";
$result = mysqli_query($link, $query);
if (!$result)
{
$error = 'Error fetching items: ' . mysqli_error($link);
include 'admin/error.html.php';
exit();
}
?>
<body>
<?php include('nav.html.php'); ?>
<div class="col-lg-9">
<div class="row">
<?php while ($item = mysqli_fetch_array($result)): ?>
<?php $url = "details.php?pid=".$item['id']; ?>
<div class="col-lg-4 col-md-6 mb-4 text-center">
<div class="card h-100">
<a href="<?php echo $url; ?>"><img class="card-img-top img-fluid" src="../shopping/img/<?php echo htmlspecialchars($item['img'], ENT_QUOTES,'UTF-8'); ?>" alt="" style="padding:5px; height: auto;width: auto; max-width: 220px; max-height: 220px;"></a>
<div class="card-block">
<h4 class="card-title"><a href="<?php echo $url;?>"><?php echo $item['name']; ?></a></h4>
<h5>Rs.<?php echo $item['price']; ?></h5>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
</div>
<br><br>
<?php include ('admin/footer.html.php');?>
</body>
</html>