getConnection(); // Get featured events $featuredEvents = []; $upcomingEvents = []; try { // Featured events $stmt = $conn->prepare("SELECT e.*, u.full_name AS organizer_name FROM events e LEFT JOIN users u ON u.id = e.vendor_id WHERE e.status = 'published' AND e.is_featured = 1 ORDER BY e.start_date ASC LIMIT 6"); $stmt->execute(); $featuredEvents = $stmt->fetchAll(PDO::FETCH_ASSOC); // Upcoming events (non-featured) $stmt = $conn->prepare("SELECT e.*, u.full_name AS organizer_name FROM events e LEFT JOIN users u ON u.id = e.vendor_id WHERE e.status = 'published' AND e.is_featured = 0 ORDER BY e.start_date ASC LIMIT 6"); $stmt->execute(); $upcomingEvents = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $e) { // Fallback try { $stmt = $conn->query("SELECT * FROM events WHERE status = 'published' ORDER BY start_date ASC LIMIT 8"); $upcomingEvents = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $e2) { /* ignore */ } } // Categories $categories = []; try { $catStmt = $conn->query("SELECT id, name FROM categories WHERE status = 'active' ORDER BY sort_order, name LIMIT 8"); $categories = $catStmt->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $e) { /* ignore */ } $categoryIcons = [ 'Music' => 'fa-music', 'Business' => 'fa-briefcase', 'Sports' => 'fa-futbol', 'Arts & Culture' => 'fa-palette', 'Food & Drink' => 'fa-utensils', 'Community' => 'fa-people-group', 'Education' => 'fa-graduation-cap', 'Other' => 'fa-ellipsis', 'Technology' => 'fa-microchip', 'Fashion' => 'fa-shirt', 'Entertainment' => 'fa-masks-theater', 'Gaming' => 'fa-gamepad', ]; function categoryIcon($name, $map) { return $map[$name] ?? 'fa-tag'; } // Get user's favorites for heart icons $userLikedIds = []; if (isset($_SESSION['user_id'])) { try { $stmt = $conn->prepare("SELECT event_id FROM favorites WHERE user_id = ?"); $stmt->execute([$_SESSION['user_id']]); $userLikedIds = array_column($stmt->fetchAll(PDO::FETCH_ASSOC), 'event_id'); } catch (Exception $e) { /* ignore */ } } ?>
From music festivals to business conferences — find and book the best events in Zambia. Join thousands of event-goers who trust Eventedia.
Join Eventedia as an organizer and reach thousands of attendees across Zambia.