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

echo "Students table columns containing 'session':\n";

$stmt = $pdo->query('DESCRIBE students');
$columns = $stmt->fetchAll(PDO::FETCH_ASSOC);

foreach ($columns as $col) {
    if (stripos($col['Field'], 'session') !== false) {
        echo $col['Field'] . ' - ' . $col['Type'] . "\n";
    }
}

echo "\nAll students table columns:\n";
foreach ($columns as $col) {
    echo $col['Field'] . "\n";
}

// Check if there's session data in existing records
echo "\nChecking sample student records for session data:\n";
$stmt = $pdo->query('SELECT id, student_id, first_name, last_name, session FROM students LIMIT 5');
$students = $stmt->fetchAll(PDO::FETCH_ASSOC);

foreach ($students as $student) {
    echo "ID: " . $student['id'] . " | Student ID: " . $student['student_id'] . " | Name: " . $student['first_name'] . " " . $student['last_name'] . " | Session: " . ($student['session'] ?? 'NULL') . "\n";
}
?>