prepare("SELECT * FROM residents WHERE user_id = ?"); $stmt->execute([$_SESSION['user_id']]); $resident = $stmt->fetch(PDO::FETCH_ASSOC); if (!$resident) { $no_profile_message = "Your profile is not yet linked. Please contact support."; } else { // Fetch action plans for the resident $stmt = $pdo->prepare("SELECT * FROM action_plans WHERE resident_id = ? ORDER BY created_at DESC"); $stmt->execute([$resident['id']]); $action_plans = $stmt->fetchAll(PDO::FETCH_ASSOC); } ?>