diff --git a/compcards.php b/compcards.php index ffdae3b..c79f293 100644 --- a/compcards.php +++ b/compcards.php @@ -11,6 +11,64 @@ error_reporting(E_ALL); $conn = db_connect(); ?> += 2) { + $like = addcslashes($searchTerm, "%_\\"); + $like = '%' . $like . '%'; + + $stmtSearch = $conn->prepare(" + SELECT productID, model, description, imagePath + FROM products + WHERE model LIKE ? OR description LIKE ? + ORDER BY model ASC + LIMIT 60 + "); + + if ($stmtSearch) { + $stmtSearch->bind_param('ss', $like, $like); + $stmtSearch->execute(); + $resultSearch = $stmtSearch->get_result(); + ?> + +
+

Suchergebnisse für „

+ + num_rows <= 0): ?> +

Keine Produkte gefunden.

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

+

+
+
+ +
+ +
+ + close(); + } + + // Wichtig: In Suchmodus KEINE Kategorien rendern. + return; +} +?> + diff --git a/header.php b/header.php index 1b3ec4c..d774274 100644 --- a/header.php +++ b/header.php @@ -162,6 +162,3 @@ })(); - - - diff --git a/productpage.php b/productpage.php index 47a10a6..bae9d3d 100644 --- a/productpage.php +++ b/productpage.php @@ -239,7 +239,7 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;