2007-07-02 05:51:26 +00:00
|
|
|
<?php
|
|
|
|
page_header(lang('Table') . ": " . htmlspecialchars($_GET["table"]));
|
|
|
|
|
2007-07-05 14:56:43 +00:00
|
|
|
$result = mysql_query("SHOW COLUMNS FROM " . idf_escape($_GET["table"]));
|
2007-07-02 05:51:26 +00:00
|
|
|
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
|
|
|
while ($row = mysql_fetch_assoc($result)) {
|
2007-07-05 14:56:43 +00:00
|
|
|
echo "<tr><th>" . htmlspecialchars($row["Field"]) . "</th><td>$row[Type]" . ($row["Null"] == "NO" ? "" : " <i>NULL</i>") . "</td></tr>\n";
|
2007-07-02 05:51:26 +00:00
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
mysql_free_result($result);
|
|
|
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'create=' . urlencode($_GET["table"]) . '">' . lang('Alter table') . "</a></p>\n";
|
|
|
|
|
2007-07-04 17:16:44 +00:00
|
|
|
echo "<h3>" . lang('Indexes') . "</h3>\n";
|
2007-07-02 05:51:26 +00:00
|
|
|
$indexes = indexes($_GET["table"]);
|
|
|
|
if ($indexes) {
|
|
|
|
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
2007-07-05 04:39:15 +00:00
|
|
|
foreach ($indexes as $index) {
|
2007-07-05 05:09:01 +00:00
|
|
|
ksort($index["columns"]);
|
2007-07-05 04:39:15 +00:00
|
|
|
echo "<tr><td>$index[type]</td><td><i>" . implode("</i>, <i>", $index["columns"]) . "</i></td></tr>\n";
|
2007-07-02 05:51:26 +00:00
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
}
|
2007-07-04 17:16:44 +00:00
|
|
|
echo '<p><a href="' . htmlspecialchars($SELF) . 'indexes=' . urlencode($_GET["table"]) . '">' . lang('Alter indexes') . "</a></p>\n";
|
2007-07-02 05:51:26 +00:00
|
|
|
|
2007-07-06 09:49:33 +00:00
|
|
|
$foreign_keys = foreign_keys($_GET["table"]);
|
|
|
|
if ($foreign_keys) {
|
2007-07-02 10:24:49 +00:00
|
|
|
echo "<h3>" . lang('Foreign keys') . "</h3>\n";
|
|
|
|
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
|
|
|
foreach ($foreign_keys as $foreign_key) {
|
2007-07-06 09:49:33 +00:00
|
|
|
echo "<tr><td><em>" . implode("</em>, <em>", $foreign_key[2]) . "</em></td><td>" . (strlen($foreign_key[0]) && $foreign_key[0] !== $_GET["db"] ? "<strong>" . htmlspecialchars($foreign_key[0]) . "</strong>." : "") . htmlspecialchars($foreign_key[1]) . "(<em>" . implode("</em>, <em>", $foreign_key[3]) . "</em>)</td></tr>\n";
|
2007-07-02 10:24:49 +00:00
|
|
|
}
|
|
|
|
echo "</table>\n";
|
|
|
|
}
|
|
|
|
|
2007-07-06 09:55:51 +00:00
|
|
|
if (mysql_get_server_info() >= 5) {
|
|
|
|
$result = mysql_query("SHOW TRIGGERS LIKE '" . mysql_real_escape_string($_GET["table"]) . "'");
|
|
|
|
if (mysql_num_rows($result)) {
|
|
|
|
echo "<h3>" . lang('Triggers') . "</h3>\n";
|
|
|
|
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
|
|
|
|
while ($row = mysql_fetch_assoc($result)) {
|
|
|
|
echo "<tr><th>$row[Timing]</th><th>$row[Event]</th><td>" . htmlspecialchars($row["Statement"]) . "</td></tr>\n";
|
|
|
|
}
|
|
|
|
echo "</table>\n";
|
2007-07-02 05:51:26 +00:00
|
|
|
}
|
2007-07-06 09:55:51 +00:00
|
|
|
mysql_free_result($result);
|
2007-07-02 05:51:26 +00:00
|
|
|
}
|