setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); exit; } // Query to fetch activities and their corresponding names $query = " SELECT a.activityID, an.activityName FROM activities a JOIN activity_names an ON a.activityID = an.activityID "; // Execute the query and fetch the results $stmt = $pdo->query($query); $activities = $stmt->fetchAll(PDO::FETCH_ASSOC); // If no activities found if (!$activities) { echo "No activities found."; exit; } ?>