![]() |
Control the organization of data table by headers
I have a table that contains data from my database. I was wondering if there was a way that I could make the headers (name, date joined, expiry date and fee) control the order of the data in both ascending and descending order. And make the which header is organizing the data currently look different (ie. when data is organized by name...name is bold while other headers are not). I've tried searching for how to do this...but have had no luck with actually accomplishing it.
I'd appreciate any help. Thanks Here's my code: PHP Code:
|
There's a lot of javascripts out there that can do this. Of course I don't know of any offhand but I've played with a lot in the past.
If you only want to do it the PHP way, well you would make each a link that references the page. So when a user clicks on the link, it re-posts the page and provides added data to your SQL query like ASC or DESC for example... Since you clicked on the header, you can now change the color to show that this header is highlighted and clicked on... The JS way though is a bit smoother because it doesn't have to reload the page, it just takes data that has already been outputted... I'm not that very good at JS though so you'd have to get a response from the JS experts around here.. |
1 Attachment(s)
Take the following as an example. Hopefully it should explain it well, and give you also a working example to build upon :-)
php Code:
Here is the form to be used in conjunction with this code: html4strict Code:
|
BTW, WH:
Did your avatar come from a bigger picture somewhere or did you make it up yourself? It kinda looks like it has a matrix background, it would be a cool wallpaper if you had a higher resolution pic of it... |
|
LOL that is such a freaky picture, I love it!
|
| All times are GMT. The time now is 07:27 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0