| From: | "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com> |
|---|---|
| To: | Molly Gibson <molly_gibson2002(at)yahoo(dot)com> |
| Cc: | <pgsql-php(at)postgresql(dot)org> |
| Subject: | Re: formatting output: grouping results with identical fields |
| Date: | 2003-05-09 22:08:24 |
| Message-ID: | Pine.LNX.4.33.0305091601570.14159-100000@css120.ihs.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-php |
On Fri, 9 May 2003, Molly Gibson wrote:
> Hi list,
> Textile geek-grrl here--I recently created a postgres
> database to keep my fabric, pattern, & project
> inventory. (Do I win a prize for 'weirdest thing for
> which someone has used postgres'?)
I'm certain there's someone out there doing something stranger than this.
> This is great for my purposes, but I'd like to clean
> up the table a bit more and have the category only
> print once each time it occurs, and the manufacturer
> only print once in each category.
What you can do is something like (this is pseudo code) before you start
your while loop:
$current_category = <category from first row>
then in your while loop, check to see if it's changed:
if ($current_category != $new_category){
print $new_category;
$current_category = $new_category;
}
Get the idea? It works a charm for things like this.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Molly Gibson | 2003-05-12 22:31:34 | Re: formatting output: grouping results with identical fields |
| Previous Message | Molly Gibson | 2003-05-09 22:06:32 | formatting output: grouping results with identical fields |