// Store metadata for future use
$_SESSION['column_count'] = pg_num_fields($res);
-$_SESSION['row_count'] = pg_num_rows($res);
+$_SESSION['actual_rows'] = pg_num_rows($res);
+$_SESSION['row_count'] = ($_SESSION['actual_rows'] < $GLOBALS['config_max_result_rows']) ? $_SESSION['actual_rows'] : $GLOBALS['config_max_result_rows'];
// Column names
for ($x = 0; $x < $_SESSION['column_count']; $x++) {
// Display the results
if ($_SESSION['column_count'] > 0) {
- $message = "Rows: " . $_SESSION['row_count'];
+ $message = "Rows: " . $_SESSION['actual_rows'];
- if ($_SESSION['row_count'] > $GLOBALS['config_max_result_rows'])
- $message .= " (limited to " . $GLOBALS['config_max_result_rows'] . ")";
+ if ($_SESSION['actual_rows'] != $_SESSION['row_count'])
+ $message .= " (limited to " . $_SESSION['row_count'] . ")";
for ($x = 0; $x < $_SESSION['row_count']; $x++) {
// Set the sub-panel ID
- $subpanel = $panel . "row" . $x + 1;
+ $subpanel = $panel . "row" . ($x + 1);
// Build the row preview list.
$list .= "<li class=\"double\"><a href=\"#" . $subpanel . "\">";
// Build the panel for this row
$divs .= "<div id=\"" . $subpanel . "\" class=\"panel\" title=\"Query row\">";
- $divs .= "<div class=\"dialogHeader\">Row: " . $x . "</div>";
+ $divs .= "<div class=\"dialogHeader\">Row: " . ($x + 1) . "</div>";
for ($y = 0; $y < $_SESSION['column_count']; $y++) {
$divs .= "<h2>" . $_SESSION['columns'][$y] . "</h2><div class=\"valueBox\">" . www_clean(truncate_value($_SESSION['rows'][$x][$y])) . "</div>";