...

View Full Version : Sorting displayed results



Kal
09-01-2006, 09:42 AM
Hi,

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.

homerUK
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:

mypage.php?sorton=postcode&orderby=asc

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum