From b441f6ae37668dffe7bd651cb4cfb603b123b72c Mon Sep 17 00:00:00 2001 From: Fabian Schieder Date: Tue, 31 Mar 2026 00:27:50 +0200 Subject: [PATCH] Add advertisement recommendation feature with styling to ad_recommendation.php --- ad_recommendation.php | 178 ++++++++++++++++++++++++++++++++++++++++++ index.php | 10 ++- 2 files changed, 187 insertions(+), 1 deletion(-) diff --git a/ad_recommendation.php b/ad_recommendation.php index 8b13789..fa180da 100644 --- a/ad_recommendation.php +++ b/ad_recommendation.php @@ -1 +1,179 @@ +query(" + SELECT productID, model, description, imagePath + FROM products + ORDER BY RAND() + LIMIT 1 +"); + +if ($stmt && $stmt->num_rows > 0) { + $randomProduct = $stmt->fetch_assoc(); + $rID = (int)$randomProduct['productID']; + $rModel = htmlspecialchars($randomProduct['model'] ?? ''); + $rDesc = htmlspecialchars($randomProduct['description'] ?? ''); + $rImg = htmlspecialchars($randomProduct['imagePath'] ?? 'assets/images/placeholder.png'); + ?> + + +
+
+
+ Empfehlung des Tages +

+

120) ? mb_substr($rDesc, 0, 120) . '...' : $rDesc ?>

+ Jetzt ansehen › +
+
+ <?= $rModel ?> +
+
+
+ diff --git a/index.php b/index.php index 71340cf..2a7f043 100644 --- a/index.php +++ b/index.php @@ -6,7 +6,15 @@ require_once __DIR__ . '/lib/bootstrap.php'; + + -