This commit is contained in:
2025-12-29 01:51:58 +01:00
parent f730c20082
commit b99239ca66

View File

@@ -8,16 +8,22 @@ $results = [];
if ($q !== '' && $pdo) { if ($q !== '' && $pdo) {
$like = '%' . $q . '%'; $like = '%' . $q . '%';
$stmt = $pdo->prepare( $sql = 'SELECT id, title, teaser_public, description, city, region, starts_at, visibility, allow_kids, location_label
'SELECT id, title, teaser_public, description, city, region, starts_at, visibility, allow_kids, location_label FROM events
FROM events WHERE starts_at >= NOW()
WHERE starts_at >= NOW() AND status != "cancelled"
AND status != "cancelled" AND (title LIKE :q1 OR teaser_public LIKE :q2 OR description LIKE :q3 OR city LIKE :q4 OR region LIKE :q5 OR zip LIKE :q6)
AND (title LIKE :q OR teaser_public LIKE :q OR description LIKE :q OR city LIKE :q OR region LIKE :q OR zip LIKE :q) ORDER BY starts_at ASC
ORDER BY starts_at ASC LIMIT 100';
LIMIT 100' $stmt = $pdo->prepare($sql);
); $stmt->execute([
$stmt->execute(['q' => $like]); ':q1' => $like,
':q2' => $like,
':q3' => $like,
':q4' => $like,
':q5' => $like,
':q6' => $like,
]);
$results = $stmt->fetchAll(PDO::FETCH_ASSOC) ?: []; $results = $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];
} }
?> ?>