X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 03A05B438DD for ; Thu, 3 Jul 2003 15:41:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 25704-02 for ; Thu, 3 Jul 2003 12:41:20 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 26B90B43A41 for ; Thu, 3 Jul 2003 12:41:15 -0300 (ADT) 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 h63FbOVG018442; Thu, 3 Jul 2003 09:38:04 -0600 (MDT) Date: Thu, 3 Jul 2003 09:31:12 -0600 (MDT) From: "scott.marlowe" To: Michael Hanna Cc: Subject: Re: query, display questions In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200307/14 X-Sequence-Number: 2126 On Thu, 3 Jul 2003, Michael Hanna wrote: > I have a table: > > michael=# \d healthnotes > Table "public.healthnotes" > Column | Type | Modifiers > --------+-------------------------- > +------------------------------------------------------------- > posted | timestamp with time zone | not null default > ('now'::text)::timestamp(6) with time zone > notes | text | > Indexes: healthnotes_pkey primary key btree (posted) > > Often there are multiple entries per day. I want to display the day > once, with all the entries on that day. > > So do I select * from notes and group by date, then write a nested > for-loop in php that ignores the extra timestamp items? Seems a little > inelegant. Or can I select distinct timestamps somehow after converting > them to dates? > > Not sure how to go about this. > > Another question: I want to echo in an html page the timestamp and the > note after it is entered. What php-pgsql commands do this? I posted some untested code and posted it to phpbuilder to do this. What I do is just grab the whole data set and use a while loop to go through each row. I store the first column and then compare it on each iteration, if it changes then print it out, otherwise print a blank kinda thing http://www.phpbuilder.com/board/showthread.php?s=&postid=10373627#post10373627