diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 27ee902c..937a173b 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -278,7 +278,7 @@ username.form['auth[driver]'].onchange(); * @return null */ function selectOrderPrint($order, $columns, $indexes) { - print_fieldset("sort", lang('Sort'), $order); + print_fieldset("sort", lang('Sort'), $order && $_GET["order"]); $i = 0; foreach ((array) $_GET["order"] as $key => $val) { if (isset($columns[$val])) { @@ -441,6 +441,17 @@ username.form['auth[driver]'].onchange(); $return[] = (isset($fields[$val]) ? idf_escape($val) : $val) . (isset($_GET["desc"][$key]) ? " DESC" : ""); } } + if (!$_GET["order"]) { + foreach ($fields as $name => $field) { + if ($field["auto_increment"]) { + foreach ($indexes as $index) { + if ($index["columns"] == array($name)) { + return array(idf_escape($name) . " DESC"); + } + } + } + } + } return $return; } diff --git a/changes.txt b/changes.txt index 38da0d63..c57cc048 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,5 @@ Adminer 3.6.4-dev: +Order by auto_increment column by default Display select SQL edit form inline Compatibility with MySQL 5.6 Recover original view, trigger, routine if creating fails