diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 672aec9e79..5201167e16 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -1560,8 +1560,11 @@ class PMA_Table if (isset($this->uiprefs[$property])) { // check if the column name is exist in this table $tmp = explode(' ', $this->uiprefs[$property]); - $colname = $tmp[0]; - $avail_columns = $this->getColumns(); + $colname = $tmp[0]; + //remove backquoting from colname + $colname = str_replace('`', '', $colname); + //get the available column name without backquoting + $avail_columns = $this->getColumns(false); foreach ($avail_columns as $each_col) { // check if $each_col ends with $colname if (substr_compare( diff --git a/libraries/sql.lib.php b/libraries/sql.lib.php index 8cf8f99927..bc1261248c 100644 --- a/libraries/sql.lib.php +++ b/libraries/sql.lib.php @@ -230,6 +230,9 @@ function PMA_handleSortOrder($db, $table, &$analyzed_sql_results, &$full_sql_que if (empty($analyzed_sql_results['analyzed_sql'][0]['order_by_clause'])) { $sorted_col = $pmatable->getUiProp(PMA_Table::PROP_SORTED_COLUMN); if ($sorted_col) { + //remove the backquoting and tablename from retrived preference to get just column name + $sorted_col = str_replace('`', '', $sorted_col); + $sorted_col = str_replace($table . '.', '', $sorted_col); // retrieve the remembered sorting order for current table $sql_order_to_append = ' ORDER BY ' . $sorted_col . ' '; $full_sql_query