Re: Output HTML, or just a handle?

From: Jason Dixon <jason(at)dixongroup(dot)net>
To: "Rodolfo J(dot) Paiz" <rpaiz(at)simpaticus(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Output HTML, or just a handle?
Date: 2005-01-25 02:20:30
Message-ID: AF0E9132-6E77-11D9-8CFE-000D93C63BA8@dixongroup.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Jan 24, 2005, at 8:47 PM, Rodolfo J. Paiz wrote:

> Hi!
>
> Looking for "best practices" here. I've just seen that psql can output
> a
> query to an HTML file. If I am creating a query within a web page, is
> it
> generally recommended to get HTML output from PostgreSQL? If so, where
> can I learn about how to put this in a query and how to control it with
> finer-grained detail as regards column borders, fonts, etc?

I haven't used this much personally, so I'm probably not qualified to
give my two cents. Of course, that's never stopped me before...

I believe this is just for outputting tables. Looking at \?, I see
that you can alter the HTML tag attributes with \T. However, there's
just something about dumping tables to a browser that feels... wrong.
Maybe that's just my paranoia speaking. *shrug*

If PHP is what you're leaning towards (Perl!), then I would stick with
the PHP database handles. Keep your presentation to the HTML and your
SQL to the database.

> Or is it recommended to just run the bare query, then use PHP on my
> webpage to loop through the resulting output table handle and create
> the
> table there? And if so, just so I don't reinvent the wheel more than
> once a day, can someone point me to any code snippets previously
> written
> on this? (That I can legally use, of course...)

This gets my vote.

--
Jason Dixon
DixonGroup Consulting
http://www.dixongroup.net

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jason Dixon 2005-01-25 02:22:14 Re: recommended programming language for postgresql
Previous Message Sean Davis 2005-01-25 02:18:06 Re: SQL and function reference?