From 737568dfd57fe0d866894adf7774f83ea65da79f Mon Sep 17 00:00:00 2001 From: Dave Page Date: Tue, 26 Aug 2008 22:35:18 +0100 Subject: [PATCH] Fix numbering. --- results.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/results.php b/results.php index 0460823..4815a0b 100644 --- a/results.php +++ b/results.php @@ -53,7 +53,8 @@ $rownum = 0; // 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++) { @@ -69,15 +70,15 @@ while (($row = pg_fetch_array($res)) && ($rownum < $GLOBALS['config_max_result_r // 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 .= "
  • "; @@ -94,7 +95,7 @@ if ($_SESSION['column_count'] > 0) { // Build the panel for this row $divs .= "
    "; - $divs .= "
    Row: " . $x . "
    "; + $divs .= "
    Row: " . ($x + 1) . "
    "; for ($y = 0; $y < $_SESSION['column_count']; $y++) { $divs .= "

    " . $_SESSION['columns'][$y] . "

    " . www_clean(truncate_value($_SESSION['rows'][$x][$y])) . "
    "; -- 2.39.5