interactivel sorting mysql tables

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
From a html file I have something like this:

<a href="showtable.php?table=clients&col=lastname"><b>Mysql

This is a general mysql table viewer for a database.

showtable.php displays the table in a browser fine. It uses the
'clients' table and sorts it by 'lastname' passed in on the command
line. The sorting is done by "order by". So far, so good.

Now I'd like to have some buttons at the top of each column to cause
the table to redisplay sorted by the column that the user clicks on.
Is this possible?
Basically I need to re-call showtable.php with different valuse for
the col parameter.

Does anyone know how I can allow the user to interactives sort columns
this way? Like a window listview control.


Re: interactivel sorting mysql tables

While the city slept, Roger Lord ( feverishly typed...

Quoted text here. Click to load it

Wouldn't the following work?

    <a href="showtable.php?table=clients&col=firstname">Sort by first
    <a href="showtable.php?table=clients&col=lastname">Sort by last name</a>
    <a href="showtable.php?table=clients&col=age">Sort by age</a>
    <a href="showtable.php?table=clients&col=haircolour">Sort by hair

    SELECT * FROM $table ORDER BY $col


Nigel Moss
Mail address not valid., take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!

Site Timeline