From ff585256724d6331707a768c8876c58a6f9bffb2 Mon Sep 17 00:00:00 2001 From: pauli Date: Thu, 29 Jan 2026 21:29:14 +0100 Subject: [PATCH] dynamic product cards --- catbar.php | 12 ++--- compcards.php | 124 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 91 insertions(+), 45 deletions(-) diff --git a/catbar.php b/catbar.php index 62890dd..1bd84f2 100644 --- a/catbar.php +++ b/catbar.php @@ -12,27 +12,27 @@ diff --git a/compcards.php b/compcards.php index 52f0506..2f93518 100644 --- a/compcards.php +++ b/compcards.php @@ -1,44 +1,90 @@ + + + + + ['id' => 20, 'label' => 'iPhone'], + 'ipad' => ['id' => 21, 'label' => 'iPad'], + 'macbook' => ['id' => 22, 'label' => 'MacBook'], + 'airpods' => ['id' => 23, 'label' => 'AirPods'], + 'accessories' => ['id' => 24, 'label' => 'Accessories'], +]; +?> + + + $cat): ?> + + + + prepare(" + SELECT productID, model, description, imagePath + FROM products + WHERE categoryID = ? + "); + + $stmt->bind_param("i", $cat['id']); // i = integer + $stmt->execute(); + + $result = $stmt->get_result(); + ?> + + num_rows > 0): ?> +
+

+ +
+ fetch_assoc()): ?> +
+ <?= htmlspecialchars($product['model']) ?> + +
+

+

+
+
+ +
+
+ + + close(); ?> + + + + + + - - - - - - -
-

iPhone

-
-
...
-
...
-
...
-
-
- - - -
-

iPad

-
-
...
-
...
-
...
-
-
- - - -
-

MacBook

-
-
...
-
...
-
...
-
-
- + \ No newline at end of file