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

// Check subject IDs for Bangla subjects for this student
$stmt = $pdo->prepare('SELECT r.*, sub.name as subject_name, sub.code as subject_code FROM results r JOIN subjects sub ON r.subject_id = sub.id WHERE r.student_id = (SELECT id FROM students WHERE student_id = ?) AND r.session = ? AND r.exam_type = ? AND (sub.name LIKE ? OR sub.name LIKE ?) ORDER BY sub.name');
$stmt->execute(['20250020', 2025, 'final', '%বাংলা%', '%Bangla%']);
$results = $stmt->fetchAll();

echo "Bangla Results with IDs:\n";
foreach ($results as $result) {
    echo "Subject ID: " . $result['subject_id'] . ", Code: " . $result['subject_code'] . ", Name: " . $result['subject_name'] . ", CQ: " . $result['cq_marks'] . ", MCQ: " . $result['mcq_marks'] . "\n";
}

// Also check what subjects exist in the subjects table
echo "\nAll subjects in database that match Bangla:\n";
$stmt2 = $pdo->prepare("SELECT * FROM subjects WHERE name LIKE ? OR name LIKE ?");
$stmt2->execute(['%বাংলা%', '%Bangla%']);
$subjects = $stmt2->fetchAll();

foreach ($subjects as $subject) {
    echo "Subject ID: " . $subject['id'] . ", Code: " . $subject['code'] . ", Name: " . $subject['name'] . "\n";
}
?>