PHP Newbie- Display Aggregates in HTML Table

From: Reed Loefgren <rloef(at)interfold(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: PHP Newbie- Display Aggregates in HTML Table
Date: 2006-04-26 13:50:52
Message-ID: 20060426073420.Q3269@auden.jmla.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

All,

I have a query that returns data that includes a sum(). I can't get this
sum to display in an html table. Like so (in part):

Example bit:

psql test: select code, blah, sum(time) from test;

Portion of PHP table code:

while($myrow = pg_fetch_assoc($result)) {
printf ("<tr><td>%s</td><td>%s</td><td>%s</td></tr>",
$myrow['code'], $myrow['blah'], $myrow['<what goes here?>']);

I'm sure there's errors here, and bad coding too, but it works just fine
if I don't have sum() or count(*) in the query. And the query works fine
with sums and counts as long as I don't try and execute it in PHP. So my
coding is wrong/uneducated. What's amiss here?

Thanks,

r

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Marc McIntyre 2006-04-27 00:20:40 Re: Object/relational mappers for PHP?
Previous Message Manuel Lemos 2006-04-22 04:17:41 Re: Object/relational mappers for PHP?