Search Postgresql Archives

Re: Database/Table Design for Global Country Statistics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$curr_yr = -1
$cols = array();
while (<fetch rows>) {
  if ($row['year'] != $curr_yr) {
    if (sizeof($cols) > 0) { display_table_row($cols); }
    $cols = array();
    $curr_year = $row['year'];
  }
  $cols[] = $row['value'];
}
// handle possible last row of table
if (sizeof($cols) > 0) { display_table_row($cols); }


Thanks for the code. I got it working with a couple of changes. But then I realized that with the new table design I can't anymore easily sort by a given year (1970 or 2000). This is surely one of the advantages of the "old" design, that the use via PHP was quite straight forward.

Do I have to transfer the query results into a PHP array to sort it in there, then?

Thanks for any hints!

Stef


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux