From: chriskl Date: Sun, 18 May 2003 11:53:27 +0000 (+0000) Subject: Display duplicate field names properly for reports, etc. X-Git-Tag: REL_3-0-BETA-1~38 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=a6bec601600fa524b96babb10cd9dd5a2dee9135;p=phppgadmin.git Display duplicate field names properly for reports, etc. --- diff --git a/BUGS b/BUGS index b5455233..19b195f7 100644 --- a/BUGS +++ b/BUGS @@ -1,3 +1,2 @@ -* Browsing reports with two identical column names is broken. * Lots more printVal()ing needs to be done. Whenever displaying user data, it should use $misc->printVal($var) instead of htmlspecialchars($var). diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index 4686544f..616f6a18 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres.php,v 1.108 2003/05/17 15:51:37 chriskl Exp $ + * $Id: Postgres.php,v 1.109 2003/05/18 11:53:28 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -757,6 +757,9 @@ class Postgres extends BaseDB { return -3; } + // Set fetch mode to NUM so that duplicate field names are properly returned + $this->conn->setFetchMode(ADODB_FETCH_NUM); + // Actually retrieve the rows, with offset and limit // @@@@@@@@@@@@@@ THIS NEXT LINE ONLY WORKS IN POSTGRESQL 7.2+ @@@@@@@@@@@@@@@@@ //$sql = "SELECT * FROM ($query) LIMIT {$page_size} OFFSET " . ($page - 1) * $page_size); diff --git a/display.php b/display.php index 0f7aca97..d90fe424 100644 --- a/display.php +++ b/display.php @@ -9,7 +9,7 @@ * @param $return_desc The return link name * @param $page The current page * - * $Id: display.php,v 1.15 2003/05/05 14:46:41 chriskl Exp $ + * $Id: display.php,v 1.16 2003/05/18 11:53:27 chriskl Exp $ */ // Include application functions @@ -41,30 +41,31 @@ // Retrieve page from table. $max_pages is returned by reference. $rs = &$localData->browseSQL($sub, $_REQUEST['count'], $_REQUEST['page'], $conf['max_rows'], $max_pages); - + if (is_object($rs) && $rs->recordCount() > 0) { // Show page navigation $misc->printPages($_REQUEST['page'], $max_pages, "display.php?page=%s&{$misc->href}&query=" . urlencode($_REQUEST['query']) . '&count=' . urlencode($_REQUEST['count']) . '&return_url=' . urlencode($_REQUEST['return_url']) . '&return_desc=' . urlencode($_REQUEST['return_desc'])); echo "\n"; - reset($rs->f); - while(list($k, ) = each($rs->f)) { - echo ""; + + foreach ($rs->f as $k => $v) { + $finfo = $rs->fetchField($k); + echo ""; } - $i = 0; - reset($rs->f); + $i = 0; while (!$rs->EOF) { $id = (($i % 2) == 0 ? '1' : '2'); echo "\n"; - while(list($k, $v) = each($rs->f)) { + foreach ($rs->f as $k => $v) { echo ""; } echo "\n"; $rs->moveNext(); $i++; } + echo "
", $misc->printVal($k), "", $misc->printVal($finfo->name), "
", $misc->printVal($v), "
\n"; echo "

", $rs->recordCount(), " {$lang['strrows']}

\n"; }