query("SHOW TABLE STATUS"); while ($row = $result->fetch_assoc()) { if (!isset($row["Engine"])) { // view continue; } $schema[$row["Name"]]["fields"] = fields($row["Name"]); if ($row["Engine"] == "InnoDB") { foreach (foreign_keys($row["Name"]) as $val) { if (!$val["db"]) { $schema[$val["table"]]["referenced"][$row["Name"]][] = array_combine($val["target"], $val["source"]); } } } } $result->free(); ?>
\n"; echo '' . htmlspecialchars($name) . "
\n"; foreach (fields($name) as $field) { $val = htmlspecialchars($field["field"]); if (preg_match('~char|text~', $field["type"])) { $val = "$val"; } elseif (preg_match('~date|time|year~', $field["type"])) { $val = "$val"; } elseif (preg_match('~binary|blob~', $field["type"])) { $val = "$val"; } elseif (preg_match('~enum|set~', $field["type"])) { $val = "$val"; } echo ($field["primary"] ? "$val" : $val) . "
\n"; $top += 1.25; } echo "
\n"; $top += 2.5; } foreach ($schema as $name => $table) { schema_table($name, $table); } ?>