aboutsummaryrefslogtreecommitdiff
path: root/public/products.php
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-05-08 17:08:54 +0200
committerlonkaars <loek@pipeframe.xyz>2023-05-08 17:08:54 +0200
commitcda96d31939c7ea727c114b162f43bb4d18314a2 (patch)
treeaa1aac2c746c5a1452b11af3f187d499b5a9ce5f /public/products.php
parent08d6281d872a8d2a496462f131cbdc860432acc0 (diff)
more website
Diffstat (limited to 'public/products.php')
-rw-r--r--public/products.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/public/products.php b/public/products.php
index e9c7cdf..bffaeb0 100644
--- a/public/products.php
+++ b/public/products.php
@@ -2,9 +2,10 @@
<?php require "db.php"; ?>
<?php
function product_template($product) {
+ $image_path = $product->img ? "/img/product/$product->id-thumb.jpg" : "/img/placeholder.png";
echo <<<"EOF"
<a href="/product.php?id=$product->id" class="product nolinkstyle">
- <img src="$product->img" alt="">
+ <img src="$image_path" alt="">
<span class="price">$product->price</span>
<span class="name">$product->name</span>
</a>
@@ -23,7 +24,7 @@ EOF;
<h2>lijst met producten:</h2>
<div class="products">
<?php
- $res = $cursor->query("select ID as id, image_path as img, price, name from webs.product");
+ $res = $cursor->query("select ID as id, image as img, price, name from webs.product");
while ($product = $res->fetch_object()) product_template($product);
?>
</div>