<?php
require_once 'config/database.php';
try {
    $stmt = $pdo->prepare('SELECT DISTINCT s.name as subject_name FROM student_subjects ss LEFT JOIN subjects s ON ss.subject_id = s.id WHERE ss.student_id = 6279');
    $stmt->execute();
    $subjects = $stmt->fetchAll();
    echo 'All student subjects:' . PHP_EOL;
    foreach ($subjects as $subject) {
        echo $subject['subject_name'] . PHP_EOL;
    }

    $stmt = $pdo->prepare('SELECT DISTINCT s.name as subject_name FROM results r LEFT JOIN subjects s ON r.subject_id = s.id WHERE r.student_id = 6279 AND r.session = 2025 AND r.exam_type = "final"');
    $stmt->execute();
    $result_subjects = $stmt->fetchAll();
    echo PHP_EOL . 'Subjects with results:' . PHP_EOL;
    foreach ($result_subjects as $subject) {
        echo $subject['subject_name'] . PHP_EOL;
    }
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . PHP_EOL;
}
?>

