On 2009-04-18, Piotr Mitoraj <piotr(dot)mitoraj(at)gmail(dot)com> wrote:
> failing to find the straight-forward answer on the web I hope to find
> some advice in here.
> I want to display the table fetched from the postgres database. The
> headers of the columns are links used to sort the data. Like the
> functionality you have on ebay when you sort according to price or time
> left. I recognized two ways of doing that:
> 1. Issue a new query to the database each time the specific sorting was
> requested. In other words, let the database do the sorting and fetch the
this is the easiest way, and a good start.
> 2. Save the table into php array and and use php built-in functions to
> sort and refresh the table.
unless you're proposing to store the store the array in $SESSION (or
similar) that's not going to work.
also you may get issues if the user opens two different queries in
> Which of those methods would be most desired in terms of performance and
> according to "the best practices"?
> What would be possible drawbacks/advantages of those methods.
this gives the best user experience but you should arrange the page
so that those with script turned off can still get the results using
one of the other methods.
In response to
pgsql-php by date
|Next:||From: Thomas Hart||Date: 2009-04-27 19:56:23|
|Subject: Newbie Question-Quoting SQL|
|Previous:||From: Piotr Mitoraj||Date: 2009-04-18 22:32:36|
|Subject: Re: sorting query results|