I think psql adds the HTML and so isn't available via SQL. In general, I
think "best practice" is to keep the database information separate from the
view of it (HTML is an example of a view of the data, but only one example).
As for reinventing the wheel, PHP is written to do just this (among other
things, but database access and display is by far the most common use, I
suggest without proof). Any book worth half its weight will have such
examples. Also, there are several websites devoted to this kind of thing.
Here is one from the top of a google search:
----- Original Message -----
From: "Rodolfo J. Paiz" <rpaiz(at)simpaticus(dot)com>
Sent: Monday, January 24, 2005 8:47 PM
Subject: [NOVICE] Output HTML, or just a handle?
> 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?
> 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...)
> Thanks for any advice. I promise not to post more questions tonight. :-)
> Rodolfo J. Paiz <rpaiz(at)simpaticus(dot)com>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
In response to
pgsql-novice by date
|Next:||From: Alexander Borkowski||Date: 2005-01-25 02:06:18|
|Subject: Re: Formatting a month in query output|
|Previous:||From: Ramon Orticio||Date: 2005-01-25 02:03:13|
|Subject: recommended programming language for postgresql|