<?php
require_once 'config/database.php';

// Check student information
$stmt = $pdo->prepare('SELECT * FROM students WHERE student_id = ?');
$stmt->execute(['20250008']);
$student = $stmt->fetch();

if ($student) {
    echo "Student: {$student['first_name']} (ID: {$student['student_id']})\n";
    
    // Check all English subjects for this student
    $stmt = $pdo->prepare('SELECT s.name, r.* FROM results r JOIN subjects s ON r.subject_id = s.id WHERE r.student_id = ? AND r.session = ? AND r.exam_type = ? AND (s.name LIKE "%English%")');
    $stmt->execute([$student['id'], '2025', 'final']);
    $results = $stmt->fetchAll();
    
    echo "English Subject Results:\n";
    foreach ($results as $result) {
        echo "  {$result['name']}: Marks={$result['marks_obtained']}, CQ={$result['cq_marks']}, MCQ={$result['mcq_marks']}, Grade={$result['grade']}\n";
    }
    
    // Check if student has both English papers
    $stmt = $pdo->prepare('SELECT s.name FROM student_subjects ss JOIN subjects s ON ss.subject_id = s.id WHERE ss.student_id = ? AND (s.name LIKE "%English%")');
    $stmt->execute([$student['id']]);
    $subjects = $stmt->fetchAll();
    
    echo "\nStudent Enrolled English Subjects:\n";
    foreach ($subjects as $subject) {
        echo "  {$subject['name']}\n";
    }
}
?>