diff --git a/ChangeLog b/ChangeLog
index 518ad6f2df..469a33b84d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -76,6 +76,7 @@ phpMyAdmin - ChangeLog
- bug #4586 Javascript error after moving a column
- bug #4576 Issue with long comments on table columns
- bug #4599 Input field unnecessarily selected on focus
+- bug #4602 Exporting selected rows exports all rows of the query
4.2.11.0 (2014-10-31)
- bug ReferenceError: Table_onover is not defined
diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php
index 17e1ddea5f..4d6a108bfd 100644
--- a/libraries/display_export.lib.php
+++ b/libraries/display_export.lib.php
@@ -140,12 +140,12 @@ function PMA_getHtmlForHiddenInput(
$html .= '';
- if (isset($_GET['sql_query'])) {
- $html .= '' . "\n";
- } elseif (! empty($sql_query)) {
+ if (! empty($sql_query)) {
$html .= '' . "\n";
+ } elseif (isset($_GET['sql_query'])) {
+ $html .= '' . "\n";
}
return $html;