<?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" AND s.name = "Bangladesh and World Introduction"');
    $stmt->execute();
    $results = $stmt->fetchAll();
    echo 'Results for Bangladesh and World Introduction:' . PHP_EOL;
    foreach ($results as $result) {
        echo 'Marks: ' . $result['marks_obtained'] . ', CQ: ' . $result['cq_marks'] . ', MCQ: ' . $result['mcq_marks'] . PHP_EOL;
    }
    if (empty($results)) {
        echo 'No results found' . PHP_EOL;
    }
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . PHP_EOL;
}
?>

