View Full Version : Sorting displayed results

09-01-2006, 09:42 AM

i have a script which will display a number of records in a table using php and mysql. once they are displayed, is there anyway that one of the headers in the table could act as a drop down menu to re-sort the records?

thanks in advance.

09-01-2006, 10:34 AM
yeah you'd just need some javascript on a <select> field maybe... then either refresh the page and put a "where" in your SQL which will get it from the URL.. .eg:


SELECT * FROM myTable ORDER BY $_GET['sorton'] $_GET['orderby']

you could do this with ajax which would be nicer for the user - ie: no page refreshing and it's all done in the background