diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php
index 6c6e5c949f..98a92c8edb 100644
--- a/libraries/rte/rte_routines.lib.php
+++ b/libraries/rte/rte_routines.lib.php
@@ -1416,37 +1416,41 @@ function PMA_RTN_handleExecute()
$GLOBALS['dbi']->freeResult($result);
- } while ($GLOBALS['dbi']->nextResult());
+ } while ($outcome = $GLOBALS['dbi']->nextResult());
- $output .= "";
+ if ($outcome) {
+ $output .= "";
- $message = __('Your SQL query has been executed successfully.');
- if ($routine['item_type'] == 'PROCEDURE') {
- $message .= '
';
+ $message = __('Your SQL query has been executed successfully.');
+ if ($routine['item_type'] == 'PROCEDURE') {
+ $message .= '
';
- // TODO : message need to be modified according to the
- // output from the routine
- $message .= sprintf(
- _ngettext(
- '%d row affected by the last statement inside the '
- . 'procedure.',
- '%d rows affected by the last statement inside the '
- . 'procedure.',
+ // TODO : message need to be modified according to the
+ // output from the routine
+ $message .= sprintf(
+ _ngettext(
+ '%d row affected by the last statement inside the '
+ . 'procedure.',
+ '%d rows affected by the last statement inside the '
+ . 'procedure.',
+ $affected
+ ),
$affected
- ),
- $affected
- );
- }
- $message = Message::success($message);
+ );
+ }
+ $message = Message::success($message);
- if ($nbResultsetToDisplay == 0) {
- $notice = __(
- 'MySQL returned an empty result set (i.e. zero rows).'
- );
- $output .= Message::notice($notice)->getDisplay();
+ if ($nbResultsetToDisplay == 0) {
+ $notice = __(
+ 'MySQL returned an empty result set (i.e. zero rows).'
+ );
+ $output .= Message::notice($notice)->getDisplay();
+ }
}
- } else {
+ }
+
+ if (! $outcome) {
$output = '';
$message = Message::error(
sprintf(