<?php
session_start();
$_SESSION['admin_id'] = 1; // Simulate admin session for testing

require 'config.php';

echo "<h2>Database Schema Check</h2>";
echo "<pre>";

// Check users table
echo "=== USERS TABLE ===\n";
$result = $conn->query("DESCRIBE users");
if ($result) {
    echo "Columns in users table:\n";
    while ($row = $result->fetch_assoc()) {
        echo "- " . $row['Field'] . " (" . $row['Type'] . ")\n";
    }
} else {
    echo "Error: " . $conn->error . "\n";
}

echo "\n=== ORDERS TABLE ===\n";
$result = $conn->query("DESCRIBE orders");
if ($result) {
    echo "Columns in orders table:\n";
    while ($row = $result->fetch_assoc()) {
        echo "- " . $row['Field'] . " (" . $row['Type'] . ")\n";
    }
} else {
    echo "Error: " . $conn->error . "\n";
}

echo "\n=== BOOKINGS TABLE ===\n";
$result = $conn->query("DESCRIBE bookings");
if ($result) {
    echo "Columns in bookings table:\n";
    while ($row = $result->fetch_assoc()) {
        echo "- " . $row['Field'] . " (" . $row['Type'] . ")\n";
    }
} else {
    echo "Error: " . $conn->error . "\n";
}

echo "\n=== CONTACTS TABLE ===\n";
$result = $conn->query("DESCRIBE contacts");
if ($result) {
    echo "Columns in contacts table:\n";
    while ($row = $result->fetch_assoc()) {
        echo "- " . $row['Field'] . " (" . $row['Type'] . ")\n";
    }
} else {
    echo "Error: " . $conn->error . "\n";
}

echo "\n=== FEEDBACK TABLE ===\n";
$result = $conn->query("DESCRIBE feedback");
if ($result) {
    echo "Columns in feedback table:\n";
    while ($row = $result->fetch_assoc()) {
        echo "- " . $row['Field'] . " (" . $row['Type'] . ")\n";
    }
} else {
    echo "Error: " . $conn->error . "\n";
}

echo "</pre>";
$conn->close();
?>
