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

// Check mark distributions for English 2nd Paper
$stmt = $pdo->prepare('SELECT id FROM subjects WHERE name = ?');
$stmt->execute(['English 2nd Paper']);
$subject = $stmt->fetch();

if ($subject) {
    echo "Subject ID for English 2nd Paper: {$subject['id']}\n";
    
    $stmt2 = $pdo->prepare('SELECT * FROM mark_distributions WHERE subject_id = ?');
    $stmt2->execute([$subject['id']]);
    $distributions = $stmt2->fetchAll();
    
    echo "Mark Distributions:\n";
    print_r($distributions);
} else {
    echo "Subject not found\n";
}

// Check all mark distributions
echo "\nAll Mark Distributions:\n";
$stmt = $pdo->query('SELECT md.*, s.name as subject_name, c.name as class_name FROM mark_distributions md JOIN subjects s ON md.subject_id = s.id JOIN classes c ON md.class_id = c.id');
$distributions = $stmt->fetchAll();

foreach ($distributions as $dist) {
    echo "Class: {$dist['class_name']}, Subject: {$dist['subject_name']}, Full Marks: {$dist['full_marks']}, Pass Marks: {$dist['pass_marks']}\n";
}
?>