<?php
require __DIR__ . '/../db_config.php';

echo "Listing all tables in database...\n";
$q = $conn->query("SHOW TABLES");
if (!$q) { echo "Error: " . $conn->error . "\n"; exit(1); }
while ($r = $q->fetch_row()) {
    $t = $r[0];
    echo "\nTable: $t\n";
    $cols = $conn->query("SHOW COLUMNS FROM `{$t}`");
    if ($cols) {
        while ($c = $cols->fetch_assoc()) {
            echo sprintf("  %s %s %s\n", $c['Field'], $c['Type'], $c['Null']);
        }
    }
}
exit(0);
