<?php
require_once 'config/database.php';
try {
    $stmt = $pdo->prepare('SELECT r.*, 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();
    $results = $stmt->fetchAll();
    echo 'Student 6279 results:' . PHP_EOL;
    foreach ($results as $result) {
        echo $result['subject_name'] . ': ' . $result['marks_obtained'] . '/' . $result['full_marks'] . ' (CQ: ' . $result['cq_marks'] . ', MCQ: ' . $result['mcq_marks'] . ')' . PHP_EOL;
    }
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . PHP_EOL;
}
?>

