38960-vm/check_pharmacy_schema.php
2026-03-21 07:52:14 +00:00

25 lines
508 B
PHP

<?php
require_once 'db/config.php';
$pdo = db();
$tables = ['drugs', 'suppliers', 'visit_prescriptions'];
foreach ($tables as $table) {
echo "--- Table: $table ---
";
try {
$stmt = $pdo->query("DESCRIBE $table");
$columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($columns as $col) {
echo "{$col['Field']} ({$col['Type']})
";
}
} catch (PDOException $e) {
echo "Error describing $table: " . $e->getMessage() . "
";
}
echo "
";
}