<?php
require_once 'config.php';
$tables = ['properties', 'monthly_fees', 'property_debts', 'payments', 'payment_reports', 'bank_transactions'];
$res = [];
foreach($tables as $t) {
    try {
        $stmt = $pdo->query("DESCRIBE `$t` ");
        $res[$t] = $stmt->fetchAll(PDO::FETCH_ASSOC);
    } catch (Exception $e) {
        $res[$t] = "Error: " . $e->getMessage();
    }
}
echo json_encode($res);
?>