diff --git a/create.inc.php b/create.inc.php index 67d9f54f..3015e873 100644 --- a/create.inc.php +++ b/create.inc.php @@ -73,8 +73,7 @@ if ($_POST) { $row["fields"][$row["auto_increment"] - 1]["auto_increment"] = true; } } elseif (strlen($_GET["create"])) { - $result = table_status($_GET["create"]); - $row = $result->fetch_assoc(); + $row = table_status($_GET["create"]); $row["name"] = $_GET["create"]; $row["fields"] = array_values(fields($_GET["create"])); } else { diff --git a/functions.inc.php b/functions.inc.php index fb13011a..bca35a4c 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -42,7 +42,8 @@ function get_vals($query) { function table_status($table) { global $mysql; - return $mysql->query("SHOW TABLE STATUS LIKE '" . $mysql->escape_string(addcslashes($table, "%_")) . "'"); + $result = $mysql->query("SHOW TABLE STATUS LIKE '" . $mysql->escape_string(addcslashes($table, "%_")) . "'"); + return $result->fetch_assoc(); } function fields($table) { diff --git a/table.inc.php b/table.inc.php index 25380260..e2301d4e 100644 --- a/table.inc.php +++ b/table.inc.php @@ -5,6 +5,7 @@ $result = $mysql->query("SHOW COLUMNS FROM " . idf_escape($_GET["table"])); if (!$result) { echo "
" . lang('Unable to show the table definition') . ": " . $mysql->error . ".
\n"; } else { + $table_status = table_status($_GET["table"]); $auto_increment_only = true; echo "| " . implode(", ", $foreign_key["source"]) . " | "; - $link = (strlen($foreign_key["db"]) ? "" . htmlspecialchars($foreign_key["db"]) . "." : "") . htmlspecialchars($foreign_key["table"]); - echo '$link(" . implode(", ", $foreign_key["target"]) . ") | "; - echo '' . (!strlen($foreign_key["db"]) ? '' . lang('Alter') . '' : ' ') . ' | '; - echo "
| " . implode(", ", $foreign_key["source"]) . " | "; + $link = (strlen($foreign_key["db"]) ? "" . htmlspecialchars($foreign_key["db"]) . "." : "") . htmlspecialchars($foreign_key["table"]); + echo '$link(" . implode(", ", $foreign_key["target"]) . ") | "; + echo '' . (!strlen($foreign_key["db"]) ? '' . lang('Alter') . '' : ' ') . ' | '; + echo "