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

try {
    // Check if academic_calendar table exists
    $stmt = $pdo->query("DESCRIBE academic_calendar");
    $columns = $stmt->fetchAll(PDO::FETCH_COLUMN);
    
    echo "Academic calendar table exists with columns:\n";
    foreach ($columns as $column) {
        echo "- " . $column . "\n";
    }
    
    // Check if there are any events
    $stmt = $pdo->query("SELECT COUNT(*) FROM academic_calendar");
    $count = $stmt->fetchColumn();
    
    echo "\nTotal events in calendar: " . $count . "\n";
    
    if ($count > 0) {
        $stmt = $pdo->query("SELECT * FROM academic_calendar ORDER BY event_date ASC LIMIT 3");
        $events = $stmt->fetchAll(PDO::FETCH_ASSOC);
        
        echo "\nSample events:\n";
        foreach ($events as $event) {
            echo "- " . $event['title'] . " (" . $event['event_date'] . ")\n";
        }
    }
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
?>