diff --git a/adminer/edit.inc.php b/adminer/edit.inc.php index edae47b5..0b6b3fbc 100644 --- a/adminer/edit.inc.php +++ b/adminer/edit.inc.php @@ -11,7 +11,7 @@ foreach ($fields as $name => $field) { if ($_POST && !$error && !isset($_GET["select"])) { $location = $_POST["referer"]; if ($_POST["insert"]) { // continue edit or insert - $location = $_SERVER["REQUEST_URI"]; //! doesn't work with change in &where field + $location = ($update ? ME . "&edit=" . urlencode($TABLE) . unique_idf($_POST["fields"], indexes($TABLE)) : $_SERVER["REQUEST_URI"]); //! doesn't work with functions } elseif (!ereg('^.+&select=.+$', $location)) { $location = ME . "select=" . urlencode($TABLE); $i = 0; // append &set converted to &where diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index bb61d4d7..90a12817 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -159,6 +159,19 @@ function unique_array($row, $indexes) { return $return; } +/** Get query string for unique identifier of a row +* @param array +* @param array result of indexes() +* @return string +*/ +function unique_idf($row, $indexes) { + $return = ""; + foreach (unique_array($row, $indexes) as $key => $val) { + $return .= "&" . (isset($val) ? urlencode("where[" . bracket_escape($key) . "]") . "=" . urlencode($val) : "null%5B%5D=" . urlencode($key)); + } + return $return; +} + /** Create SQL condition from parsed query string * @param array parsed query string * @return string diff --git a/adminer/select.inc.php b/adminer/select.inc.php index 847363b8..a24b78b0 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -205,11 +205,7 @@ if (!$columns) { } echo ($backward_keys ? "