From dfd10b34fef6f4bcadd148c5758f3ce1aa867218 Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Thu, 27 Nov 2014 15:06:14 +0530 Subject: [PATCH] Serve both ajax and non-ajax scenarios Signed-off-by: Madhura Jayaratne --- libraries/sql.lib.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/libraries/sql.lib.php b/libraries/sql.lib.php index 2a6662cd39..565eaa862b 100644 --- a/libraries/sql.lib.php +++ b/libraries/sql.lib.php @@ -1572,17 +1572,22 @@ function PMA_getQueryResponseForNoResultsReturned($analyzed_sql_results, $db, $html_output = ''; if (!isset($GLOBALS['show_as_php'])) { - if ($GLOBALS['cfg']['ShowSQL']) { - $html_output .= PMA_Util::getMessage( - $message, $GLOBALS['sql_query'], 'success' - ); - } - - $response = PMA_Response::getInstance(); if (isset($GLOBALS['reload']) && $GLOBALS['reload'] == 1) { $extra_data['reload'] = 1; $extra_data['db'] = $GLOBALS['db']; } + + $GLOBALS['message'] = $message; + if (empty($_REQUEST['ajax_page_request'])) { + $extra_data['message'] = $message; + if ($GLOBALS['cfg']['ShowSQL']) { + $extra_data['sql_query'] = PMA_Util::getMessage( + $message, $GLOBALS['sql_query'], 'success' + ); + } + } + + $response = PMA_Response::getInstance(); $response->addJSON(isset($extra_data) ? $extra_data : array()); $query_type = PMA_DisplayResults::QUERY_TYPE_SELECT;