} else {
$row = array("fields" => array());
}
-//! collate columns, references, indexes, unsigned, zerofill, default
+//! collate columns, references, unsigned, zerofill, default
?>
<form action="" method="post">
<p>
include "./edit.inc.php";
} elseif (isset($_GET["create"])) {
include "./create.inc.php";
+} elseif (isset($_GET["indexes"])) {
+ include "./indexes.inc.php";
} elseif (isset($_GET["dump"])) {
include "./dump.inc.php";
} elseif (isset($_GET["view"])) {
--- /dev/null
+<?php
+$index_types = array("PRIMARY", "UNIQUE", "INDEX", "FULLTEXT");
+if ($_POST) {
+}
+
+page_header(lang('Indexes') . ': ' . htmlspecialchars($_GET["indexes"]));
+echo "<h2>" . lang('Indexes') . ': ' . htmlspecialchars($_GET["indexes"]) . "</h2>\n";
+
+if ($_POST) {
+ echo "<p class='error'>" . lang('Unable to operate indexes') . ": " . htmlspecialchars($error) . "</p>\n";
+ $row = $_POST;
+} else {
+ $row = array("indexes" => indexes($_GET["indexes"]));
+}
+?>
+<form action="" method="post">
+<table border="0" cellspacing="0" cellpadding="2">
+<?php
+$fields = array_keys(fields($_GET["indexes"]));
+$j = 0;
+foreach ($row["indexes"] as $type => $index) {
+ foreach ($index as $columns) {
+ echo "<tr><td><select name='indexes[$j][type]'><option></option>" . optionlist($index_types, $type, "not_vals") . "</select></td><td>";
+ sort($columns);
+ foreach ($columns as $i => $column) {
+ echo "<select name='indexes[$j][columns][$i]'><option></option>" . optionlist($fields, $column, "not_vals") . "</select>";
+ }
+ echo "<select name='indexes[$j][columns][" . ($i+1) . "]'><option></option>" . optionlist($fields, array(), "not_vals") . "</select>";
+ echo "</td></tr>\n";
+ $j++;
+ }
+}
+//! JavaScript for adding more indexes and columns
+?>
+<tr><td><select name="indexes[<?php echo $j; ?>][type]"><option></option><?php echo optionlist($index_types, array(), "not_vals"); ?></select></td><td><select name="indexes[<?php echo $j; ?>][columns][1]"><option></option><?php echo optionlist($fields, array(), "not_vals"); ?></select></td></tr>
+</table>
+<p><input type="submit" value="<?php echo lang('Alter indexes'); ?>" /></p>
+</form>
mysql_free_result($result);
echo '<p><a href="' . htmlspecialchars($SELF) . 'create=' . urlencode($_GET["table"]) . '">' . lang('Alter table') . "</a></p>\n";
+echo "<h3>" . lang('Indexes') . "</h3>\n";
$indexes = indexes($_GET["table"]);
if ($indexes) {
- echo "<h3>" . lang('Indexes') . "</h3>\n";
echo "<table border='1' cellspacing='0' cellpadding='2'>\n";
foreach ($indexes as $type => $index) {
foreach ($index as $columns) {
}
echo "</table>\n";
}
+echo '<p><a href="' . htmlspecialchars($SELF) . 'indexes=' . urlencode($_GET["table"]) . '">' . lang('Alter indexes') . "</a></p>\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)) {