-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcourses.html
More file actions
48 lines (44 loc) · 2.37 KB
/
courses.html
File metadata and controls
48 lines (44 loc) · 2.37 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="https://i.ibb.co/LNxQL4M/bina.jpg" type="image/x-icon">
<title>KnowTheBox-Store</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<?php include('header.php'); ?>
<div class="container mt-5">
<div class="row">
<!-- Display Products from Database -->
<?php
include('db.php');
$query = "SELECT * FROM products LIMIT 9";
$result = mysqli_query($conn, $query);
while ($product = mysqli_fetch_assoc($result)) {
// Generate the URL for the image, which calls the get_image.php script
$imageUrl = 'get_image.php?id=' . $product['product_id'];
echo '
<div class="col-md-4 mb-4">
<div class="card">
<img src="' . $imageUrl . '" class="card-img-top" alt="' . $product['name'] . '" style="width: 100%; height: 300px; object-fit: cover;">
<div class="card-body">
<h5 class="card-title">' . $product['name'] . '</h5>
<p class="card-text">$' . $product['price'] . '</p>
<a href="product.php?id=' . $product['product_id'] . '" class="btn btn-primary">View Product</a>
</div>
</div>
</div>
';
}
?>
</div>
</div>
<?php include('footer.php'); ?>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>