38471-vm/describe_tables.php
2026-02-20 12:42:58 +00:00

14 lines
392 B
PHP

<?php
require 'db/config.php';
foreach(['pos_transactions', 'invoices', 'pos_items', 'invoice_items'] as $t) {
echo "Table: $t\n";
try {
$res = db()->query("DESCRIBE $t");
while($r = $res->fetch(PDO::FETCH_ASSOC)) {
echo " {$r['Field']} ({$r['Type']})\n";
}
} catch (Exception $e) {
echo " Error: " . $e->getMessage() . "\n";
}
}