-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
52 lines (40 loc) · 1.2 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
<?php
include 'incs/header.php';
include 'classes/dbh.php';
$dbh = new Dbh();
?>
<body>
<?php
include 'incs/navBar.php';
?>
<div id="homepage-banner"></div>
<h2 class="homepage-title">Onze producten</h2>
<div id="products-wrapper">
<?php
$stmt = $dbh->connection()->prepare("SELECT * FROM product INNER JOIN product_category ON product.product_category = product_category.category_id INNER JOIN product_image ON product_image.product_id = product.product_id WHERE product_availability = 'true' AND product_quantity > 0 ORDER BY rand() LIMIT 12;");
$stmt->execute();
$result = $stmt->fetchAll();
foreach ($result as $row) {
echo "
<div class=\"product\">
<div class=\"imgbox\">
<img src=\"imgs/$row[image_name]\">
</div>
<div class=\"details\">
<h2>$row[product_name]<br><span>$row[category_name]</span></h2>
<div class=\"price\">
€$row[product_price],-
</div>
<a href=\"viewProduct.php?id=$row[product_id]\">Bekijken</a>
</div>
</div>
";
}
?>
</div>
<div id="more-products">
<a href="products.php" id="more-products-href">Bekijk alle producten</a>
</div>
<?php
include 'incs/footer.php';
?>