<?php
chdir('../');
session_start();
require_once('public/connection.php');

include('partials/header.php');
include('partials/navbar.php');
include('partials/sidebar.php');
include('partials/alert.php');

if (!isset($_SESSION['staff_id'])) {
    header("Location: ../index.php");
    exit;
}

$exams = $conn->query("SELECT id, title FROM exams ORDER BY created_at DESC");

?>

Content

<?php include('partials/footer.php'); ?>

-- 1. Drop existing constraint
ALTER TABLE malpractice_logs
DROP FOREIGN KEY malpractice_logs_ibfk_2;

-- 2. Add new one with ON DELETE CASCADE
ALTER TABLE malpractice_logs
ADD CONSTRAINT malpractice_logs_ibfk_2
FOREIGN KEY (exam_id)
REFERENCES exams(id)
ON DELETE CASCADE;


SELECT * FROM `exam_results` WHERE 
`id`, `student_id`, `exam_id`, `total_questions`, `correct_answers`, `mcq_score`, `theory_score`, `total_score`, `status`

SELECT * FROM `classes` WHERE 
`id`, `classes`

SELECT * FROM `school_subjects` WHERE 
`id`, `subjects`

SELECT * FROM `exams` WHERE 
`id`, `title`, `class`, `subject_id`, `duration_minutes`, `exam_date`, `term`, `session`

using this queries, how can i get student results from exam_results table?

SELECT * FROM `exam_answers` WHERE 1
`id`, `exam_result_id`, `student_id`, `question_id`, `answer_text`

<?php
chdir('../');
session_start();
require_once('public/connection.php');

include('partials/header.php');
include('partials/navbar.php');
include('partials/sidebar.php');
include('partials/alert.php');

// Check if admin is logged in
if (!isset($_SESSION['staff_id'])) {
    header("Location: ../index.php");
    exit;
}


?>

<?php include('partials/footer.php'); ?>
