$current_user_id]; if ($filterCity) { $sql .= " AND p.city LIKE :city"; $params[':city'] = '%' . $filterCity . '%'; } if ($filterActivity) { $sql .= " AND p.bio LIKE :activity"; $params[':activity'] = '%' . $filterActivity . '%'; } $sql .= " ORDER BY RAND() LIMIT 1"; $stmt = $pdo->prepare($sql); $stmt->execute($params); $companion = $stmt->fetch(PDO::FETCH_ASSOC); // Fetch matches for the logged-in user $stmt = $pdo->prepare(" SELECT p.* FROM matches m JOIN user_profiles p ON (m.user1_id = p.user_id OR m.user2_id = p.user_id) WHERE (m.user1_id = :current_user_id OR m.user2_id = :current_user_id) AND p.user_id != :current_user_id "); $stmt->execute(['current_user_id' => $current_user_id]); $matches = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($matches as &$m) { $m['img'] = $m['profile_photo_path'] ?? 'assets/images/avatar_placeholder.svg'; } unset($m); $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Find your perfect vetted companion for platonic experiences.'; $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; ?>