Sortable Table headings
Posted: Tue Oct 03, 2006 10:14 am
Hi guys, im stuck with this problem and im hoping someone can help me out.
i am using php/mysql and I have a table with various fields including the following:
barcode
firstname
lastname
status etc
I query the database (mysql) and it displays the result sorted by barcode. im trying to make it so taht everytime the result is displayed on the html page, the table headers become a link and users can click on them so it gets sorted accordingly. for example if i ran a query that displays all the barcodes in the database, it'd look like this:
barcode firstname lastname status
----------------------------------------------
123 test test available
234 john doe available
343 ted ted not available
etc....
but if i wanted to resort the results dynamically, i can't do that because the headers aren't clickable. so i was wondering if anyone knows a way of making the headers clickable so that when the user clicks on lets say firstname, it sorts the result using firstname field in the database.
thanks in advance.
i am using php/mysql and I have a table with various fields including the following:
barcode
firstname
lastname
status etc
I query the database (mysql) and it displays the result sorted by barcode. im trying to make it so taht everytime the result is displayed on the html page, the table headers become a link and users can click on them so it gets sorted accordingly. for example if i ran a query that displays all the barcodes in the database, it'd look like this:
barcode firstname lastname status
----------------------------------------------
123 test test available
234 john doe available
343 ted ted not available
etc....
but if i wanted to resort the results dynamically, i can't do that because the headers aren't clickable. so i was wondering if anyone knows a way of making the headers clickable so that when the user clicks on lets say firstname, it sorts the result using firstname field in the database.
thanks in advance.