X-Original-To: pgsql-php@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id C5026475B99 for ; Fri, 9 May 2003 18:20:18 -0400 (EDT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by postgresql.org (Postfix) with ESMTP id EFF03474E4F for ; Fri, 9 May 2003 18:19:42 -0400 (EDT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h49MJDna016542; Fri, 9 May 2003 16:19:13 -0600 (MDT) Date: Fri, 9 May 2003 16:08:24 -0600 (MDT) From: "scott.marlowe" To: Molly Gibson Cc: Subject: Re: formatting output: grouping results with identical fields In-Reply-To: <20030509220323.75714.qmail@web41811.mail.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Spam-Status: No, hits=-20.7 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,NO_DNS_FOR_FROM, USER_AGENT_PINE autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/8 X-Sequence-Number: 2013 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 = 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.