Fix numbering.
authorDave Page <dpage@developer.pgadmin.org>
Tue, 26 Aug 2008 21:35:18 +0000 (22:35 +0100)
committerDave Page <dpage@developer.pgadmin.org>
Tue, 26 Aug 2008 21:35:18 +0000 (22:35 +0100)
results.php

index 0460823d2054027a88f5bcb87a7d060fdb21b0b7..4815a0bdc429a2d0f12bb2fe9e2fe23bacfc02f8 100644 (file)
@@ -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 .= "<li class=\"double\"><a href=\"#" . $subpanel . "\">";
@@ -94,7 +95,7 @@ if ($_SESSION['column_count'] > 0) {
 
                // 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>";