diff --git a/ChangeLog b/ChangeLog index 7eee473a1..7a31af758 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA - bug #2823996 [data] Cannot edit row with no PK and a BIT field - bug [export] Exporting results of a query which contains a LIMIT clause inside a subquery +- bug #2837722 [export] Run complex SQL then export does not work 3.2.1.0 (2009-08-09) - bug #2799009 Login with ipv6 IP address breaks redirect diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index d983db322..52233d570 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -2149,6 +2149,19 @@ function PMA_displayResultsOperations($the_disp_mode, $analyzed_sql) { $header_shown = TRUE; } $_url_params['unlim_num_rows'] = $unlim_num_rows; + + /** + * At this point we don't know the table name; this can happen + * for example with a query like + * SELECT bike_code FROM (SELECT bike_code FROM bikes) tmp + * As a workaround we set in the table parameter the name of the + * first table of this database, so that tbl_export.php and + * the script it calls do not fail + */ + if (empty($_url_params['table'])) { + $_url_params['table'] = PMA_DBI_fetch_value("SHOW TABLES"); + } + echo PMA_linkOrButton( 'tbl_export.php' . PMA_generate_common_url($_url_params), PMA_getIcon('b_tblexport.png', $GLOBALS['strExport'], false, true),