Re: Database/Table Design for Global Country Statistics

Поиск
Список
Период
Сортировка
От Stefan Schwarzer
Тема Re: Database/Table Design for Global Country Statistics
Дата
Msg-id 62A8F986-2813-44AE-B828-98B0502FA746@grid.unep.ch
обсуждение исходный текст
Ответ на Re: Database/Table Design for Global Country Statistics  (Richard Huxton <dev@archonet.com>)
Ответы Re: Database/Table Design for Global Country Statistics  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
> $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


В списке pgsql-general по дате отправления:

Предыдущее
От: Cultural Sublimation
Дата:
Сообщение: Re: Cannot declare record members NOT NULL
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Cannot declare record members NOT NULL