From 847347fb5511f6c526e41e0e5963e6d4f3882e58 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 8 May 2023 13:20:14 +0200 Subject: WIP show products in database --- db/init.sql | 2 +- public/db.php | 1 + public/products.php | 36 ++++++++++++++++-------------------- 3 files changed, 18 insertions(+), 21 deletions(-) create mode 100644 public/db.php diff --git a/db/init.sql b/db/init.sql index c842e52..872d456 100644 --- a/db/init.sql +++ b/db/init.sql @@ -10,7 +10,7 @@ create table if not exists webs.product ( `ID` int not null auto_increment, `name` varchar(255) not null, `price` decimal(5, 2) not null, - `image` mediumblob null default null, + `image_path` varchar(255) not null default "img/placeholder.png", `category` int not null, primary key (`ID`), constraint `product_category_fk` diff --git a/public/db.php b/public/db.php new file mode 100644 index 0000000..6d158b7 --- /dev/null +++ b/public/db.php @@ -0,0 +1 @@ + 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 @@ + +id" class="product nolinkstyle"> + + $product->price + $product->name + +EOF; +} +?> @@ -10,26 +22,10 @@

lijst met producten:

- - - 3,45 - courgette - - - - 3,45 - courgette - - - - 3,45 - courgette - - - - 3,45 - courgette - + query("select ID as id, image_path as img, price, name from webs.product"); + while ($product = $res->fetch_object()) product_template($product); + ?>
-- cgit v1.2.3