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

// Test query to see what fields are available in results table
try {
    $stmt = $pdo->query("SELECT * FROM results LIMIT 1");
    $result = $stmt->fetch(PDO::FETCH_ASSOC);
    
    if ($result) {
        echo "Available fields in results table:\n";
        foreach ($result as $field => $value) {
            echo "- $field\n";
        }
    } else {
        echo "No data found in results table\n";
    }
    
    // Check if detailed mark fields exist
    $detailed_fields = ['cq_marks', 'mcq_marks', 'practical_marks', 'assignment_marks', 'attendance_marks'];
    $found_fields = [];
    
    foreach ($detailed_fields as $field) {
        if (array_key_exists($field, $result)) {
            $found_fields[] = $field;
        }
    }
    
    echo "\nDetailed mark fields found: " . (empty($found_fields) ? "None" : implode(', ', $found_fields)) . "\n";
    
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
?>