aboutsummaryrefslogtreecommitdiff
path: root/public/products.php
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-05-08 13:20:14 +0200
committerlonkaars <loek@pipeframe.xyz>2023-05-08 13:20:14 +0200
commit847347fb5511f6c526e41e0e5963e6d4f3882e58 (patch)
tree7559f1dcb2b55871b17eed1d7081b10d97026108 /public/products.php
parent14997bb700d5bc30d69a48294ae26a7e566939c5 (diff)
WIP show products in database
Diffstat (limited to 'public/products.php')
-rw-r--r--public/products.php36
1 files changed, 16 insertions, 20 deletions
diff --git a/public/products.php b/public/products.php
index 077702a..e9c7cdf 100644
--- a/public/products.php
+++ b/public/products.php
@@ -1,4 +1,16 @@
<!DOCTYPE html>
+<?php require "db.php"; ?>
+<?php
+function product_template($product) {
+ echo <<<"EOF"
+ <a href="/product.php?id=$product->id" class="product nolinkstyle">
+ <img src="$product->img" alt="">
+ <span class="price">$product->price</span>
+ <span class="name">$product->name</span>
+ </a>
+EOF;
+}
+?>
<html>
<head>
<?php include 'head.php' ?>
@@ -10,26 +22,10 @@
<div class="main limwidth">
<h2>lijst met producten:</h2>
<div class="products">
- <a href="/product.php?id=123" class="product nolinkstyle">
- <img src="img/placeholder.png" alt="">
- <span class="price">3,45</span>
- <span class="name">courgette</span>
- </a>
- <a href="/product.php?id=123" class="product nolinkstyle">
- <img src="img/placeholder.png" alt="">
- <span class="price">3,45</span>
- <span class="name">courgette</span>
- </a>
- <a href="/product.php?id=123" class="product nolinkstyle">
- <img src="img/placeholder.png" alt="">
- <span class="price">3,45</span>
- <span class="name">courgette</span>
- </a>
- <a href="/product.php?id=123" class="product nolinkstyle">
- <img src="img/placeholder.png" alt="">
- <span class="price">3,45</span>
- <span class="name">courgette</span>
- </a>
+ <?php
+ $res = $cursor->query("select ID as id, image_path as img, price, name from webs.product");
+ while ($product = $res->fetch_object()) product_template($product);
+ ?>
</div>
</div>
<?php include 'footer.php' ?>