<?php
require_once '../includes/db.php';

echo "<h3>Database Table Check</h3>";

// Check events table
echo "<h4>Events Table:</h4>";
try {
    $result = $pdo->query("DESCRIBE events");
    echo "<pre>";
    while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
        echo $row['Field'] . " (" . $row['Type'] . ")\n";
    }
    echo "</pre>";
    
    $count = $pdo->query("SELECT COUNT(*) FROM events")->fetchColumn();
    echo "Total events: $count<br>";
} catch (Exception $e) {
    echo "ERROR: " . $e->getMessage() . "<br>";
}

// Check event_heat_settings
echo "<h4>Event Heat Settings Table:</h4>";
try {
    $result = $pdo->query("DESCRIBE event_heat_settings");
    echo "<pre>";
    while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
        echo $row['Field'] . " (" . $row['Type'] . ")\n";
    }
    echo "</pre>";
} catch (Exception $e) {
    echo "ERROR: " . $e->getMessage() . "<br>";
}

// Check event_categories
echo "<h4>Event Categories Table:</h4>";
try {
    $result = $pdo->query("DESCRIBE event_categories");
    echo "<pre>";
    while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
        echo $row['Field'] . " (" . $row['Type'] . ")\n";
    }
    echo "</pre>";
} catch (Exception $e) {
    echo "ERROR: " . $e->getMessage() . "<br>";
}
