$existing) { if ($index["type"] == $existing["type"] && $existing["columns"] == $columns) { unset($indexes[$name]); continue 2; } } $alter[] = "ADD $index[type]" . ($index["type"] == "PRIMARY" ? " KEY" : "") . " (" . implode(", ", array_map('idf_escape', $columns)) . ")"; } } } foreach ($indexes as $name => $existing) { $alter[] = "DROP INDEX " . idf_escape($name); } if (!$alter || $mysql->query("ALTER TABLE " . idf_escape($_GET["indexes"]) . " " . implode(", ", $alter))) { redirect($SELF . "table=" . urlencode($_GET["indexes"]), ($alter ? lang('Indexes has been altered.') : null)); } $error = $mysql->error; } page_header(lang('Indexes') . ': ' . htmlspecialchars($_GET["indexes"])); if ($_POST) { if (!$_POST["add"]) { echo "
" . lang('Unable to operate indexes') . ": " . htmlspecialchars($error) . "
\n"; } $row = $_POST; } else { $row = array("indexes" => $indexes); } ?>