diff --git a/db_search.php b/db_search.php
index e7b8015a40..fabb440969 100644
--- a/db_search.php
+++ b/db_search.php
@@ -199,27 +199,45 @@ if (isset($_REQUEST['submit_search'])) {
return $sql;
} // end of the "PMA_getSearchSqls()" function
+ echo PMA_dbSearchGetSearchResults(
+ $tables_selected, $searched, $option_str,
+ $search_str, $search_option, (! empty($field_str) ? $field_str : '')
+ );
+} // end 1.
-
- /**
- * Displays the results
- */
+/**
+ * Displays the results
+ *
+ * @param array $tables_selected Tables on which search is to be performed
+ * @param string $searched The search word/phrase/regexp
+ * @param string $option_str Type of search
+ * @param string $search_str the string to search
+ * @param integer $search_option type of search
+ * (1 -> 1 word at least, 2 -> all words,
+ * 3 -> exact string, 4 -> regexp)
+ * @param string $field_str Restrict the search to this field
+ *
+ * @return string HTML results *
+ */
+function PMA_dbSearchGetSearchResults($tables_selected, $searched, $option_str,
+ $search_str, $search_option, $field_str = null
+) {
$this_url_params = array(
'db' => $GLOBALS['db'],
'goto' => 'db_sql.php',
'pos' => 0,
'is_js_confirmed' => 0,
);
-
+ $html_output = '';
// Displays search string
- echo '
' . "\n"
- . '
| ' . sprintf( - _ngettext('%1$s match inside table %2$s', '%1$s matches inside table %2$s', $res_cnt), - $res_cnt, htmlspecialchars($each_table) - ) . " | \n"; + $html_output .= '||||||
| '; + $html_output .= sprintf( + _ngettext( + '%1$s match inside table %2$s', + '%1$s matches inside table %2$s', $res_cnt + ), + $res_cnt, htmlspecialchars($each_table) + ); + $html_output .= ' | '; if ($res_cnt > 0) { $this_url_params['sql_query'] = $newsearchsqls['select_fields']; - $browse_result_path = 'sql.php' . PMA_generate_common_url($this_url_params); - ?> -- ' + . __('Browse') . ''; $this_url_params['sql_query'] = $newsearchsqls['delete']; $delete_result_path = 'sql.php' . PMA_generate_common_url($this_url_params); - ?> - | - ' + . __('Delete') . ''; } else { - echo ' | ' . "\n" - .' | ' . "\n"; + $html_output .= ' | ' + .' | '; }// end if else $odd_row = ! $odd_row; - echo ' |
' . sprintf( - _ngettext('Total: %s match', 'Total: %s matches', $num_search_result_total), + $html_output .= '
'; + $html_output .= sprintf( + _ngettext( + 'Total: %s match', + 'Total: %s matches', + $num_search_result_total + ), $num_search_result_total - ) . '
' . "\n"; + ); + $html_output .= ''; } -} // end 1. + return $html_output; +} /** * If we are in an Ajax request, we need to exit after displaying all the HTML