prepare("SELECT * FROM exams WHERE id = ?"); $exam_stmt->execute([$exam_id]); $exam = $exam_stmt->fetch(); if (!$exam) { // Exam not found header("Location: dashboard_siswa.php"); exit(); } // Fetch questions and choices $questions_stmt = db()->prepare("SELECT * FROM questions WHERE exam_id = ? ORDER BY id"); $questions_stmt->execute([$exam_id]); $questions = $questions_stmt->fetchAll(); $page_title = "Kerjakan Ujian: " . htmlspecialchars($exam['title']); ?> <?php echo $page_title; ?> - Ulangan Harian Online

$question): ?>
Pertanyaan #

prepare("SELECT * FROM choices WHERE question_id = ? ORDER BY id"); $choices_stmt->execute([$question['id']]); $choices = $choices_stmt->fetchAll(); ?>