prepare("SELECT * FROM training_sessions WHERE id = ? AND coach_id = ?"); $stmt->execute([$session_id, $coach_id]); $session = $stmt->fetch(PDO::FETCH_ASSOC); if (!$session) { // Or show a 404 not found page header('Location: training_sessions.php'); exit(); } // Fetch the drills for this session, in order $stmt = $pdo->prepare( "SELECT d.* FROM drills d JOIN training_session_drills tsd ON d.id = tsd.drill_id WHERE tsd.session_id = ? " ); $stmt->execute([$session_id]); $drills = $stmt->fetchAll(PDO::FETCH_ASSOC); $pageTitle = htmlspecialchars($session['name']); $pageDescription = htmlspecialchars(substr($session['description'], 0, 150)); ?>
Drills in this Session

This training session has no drills.

$drill): ?>