" . lang('Table') . ": " . htmlspecialchars($_GET["table"]) . "\n"; $result = mysql_query("SHOW FULL COLUMNS FROM " . idf_escape($_GET["table"])); echo "\n"; while ($row = mysql_fetch_assoc($result)) { echo "\n"; } echo "
" . htmlspecialchars($row["Field"]) . "$row[Type]" . ($row["Null"] == "NO" ? " NOT NULL" : "") . "
\n"; mysql_free_result($result); echo '

' . lang('Alter table') . "

\n"; $indexes = indexes($_GET["table"]); if ($indexes) { echo "

" . lang('Indexes') . "

\n"; echo "\n"; foreach ($indexes as $type => $index) { foreach ($index as $columns) { sort($columns); echo "\n"; } } echo "
$type" . implode(", ", $columns) . "
\n"; } $result = mysql_query("SELECT * FROM information_schema.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA = '" . mysql_real_escape_string($_GET["db"]) . "' AND TABLE_NAME = '" . mysql_real_escape_string($_GET["table"]) . "' AND REFERENCED_TABLE_NAME IS NOT NULL ORDER BY ORDINAL_POSITION"); if (mysql_num_rows($result)) { $foreign_keys = array(); while ($row = mysql_fetch_assoc($result)) { $foreign_keys[$row["CONSTRAINT_NAME"]][0] = $row["REFERENCED_TABLE_SCHEMA"]; $foreign_keys[$row["CONSTRAINT_NAME"]][1] = $row["REFERENCED_TABLE_NAME"]; $foreign_keys[$row["CONSTRAINT_NAME"]][2][] = htmlspecialchars($row["COLUMN_NAME"]); $foreign_keys[$row["CONSTRAINT_NAME"]][3][] = htmlspecialchars($row["REFERENCED_COLUMN_NAME"]); } echo "

" . lang('Foreign keys') . "

\n"; echo "\n"; foreach ($foreign_keys as $foreign_key) { echo "\n"; } echo "
" . implode(", ", $foreign_key[2]) . "" . (strlen($foreign_key[0]) && $foreign_key[0] !== $_GET["db"] ? "" . htmlspecialchars($foreign_key[0]) . "." : "") . "" . htmlspecialchars($foreign_key[1]) . "(" . implode(", ", $foreign_key[3]) . ")
\n"; } mysql_free_result($result); $result = mysql_query("SHOW TRIGGERS LIKE '" . mysql_real_escape_string($_GET["table"]) . "'"); if (mysql_num_rows($result)) { echo "

" . lang('Triggers') . "

\n"; echo "\n"; while ($row = mysql_fetch_assoc($result)) { echo "\n"; } echo "
$row[Timing]$row[Event]" . htmlspecialchars($row["Statement"]) . "
\n"; } mysql_free_result($result);