interactivel sorting mysql tables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger  Lord

    interactivel sorting mysql tables

    From a html file I have something like this:

    <a href="showtable .php?table=clie nts&col=lastnam e"><b>Mysql
    Table</b></a>

    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.

    thanks,
    Roger


  • nice.guy.nige

    #2
    Re: interactivel sorting mysql tables

    While the city slept, Roger Lord (rlord17889@yah oo.com) feverishly typed...
    [color=blue]
    > From a html file I have something like this:
    >
    > <a href="showtable .php?table=clie nts&col=lastnam e"><b>Mysql
    > Table</b></a>
    >
    > 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.
    >
    > thanks,
    > Roger[/color]

    Wouldn't the following work?

    <a href="showtable .php?table=clie nts&col=firstna me">Sort by first
    name</a>
    <a href="showtable .php?table=clie nts&col=lastnam e">Sort by last name</a>
    <a href="showtable .php?table=clie nts&col=age">So rt by age</a>
    <a href="showtable .php?table=clie nts&col=haircol our">Sort by hair
    colour</a>

    SELECT * FROM $table ORDER BY $col

    Cheers,
    Nige

    --
    Nigel Moss
    This is the personal website of Nigel Moss - Web and software developer, musician, photographer. It is home to my CV, portfolio, general info and more.

    Mail address not valid. nigel@DOG.nigen et.org.uk, take the DOG. out!
    In the land of the blind, the one-eyed man is very, very busy!


    Comment

    Working...