<?php
require_once 'db.php';
$res = $conn->query("DESCRIBE events");
$columns = [];
while ($row = $res->fetch_assoc()) {
    $columns[] = $row;
}

$res = $conn->query("DESCRIBE event_participants");
$participants_columns = [];
if ($res) {
    while ($row = $res->fetch_assoc()) {
        $participants_columns[] = $row;
    }
}

echo json_encode([
    "events" => $columns,
    "event_participants" => $participants_columns
], JSON_PRETTY_PRINT);
$conn->close();
?>