AlbumFiend Posted August 12, 2009 Share Posted August 12, 2009 Hey I'm new here, just signed up, and was hoping to get some help implementing some features into this PHP script. I didn't personally code it and I'm almost brand new when it comes to coding in PHP. Basically my table is set up so that it has a date header and each item listed has their date added attached. I was hoping to be able to make the date header clickable so it would sort the information already in the table by date. I found this on another forum when looking it up: select * from table order by datecolumn desc But I'm not sure how to implement it Link to comment https://forums.phpfreaks.com/topic/169985-sort-by-date/ Share on other sites More sharing options...
p2grace Posted August 12, 2009 Share Posted August 12, 2009 Add links to the header that add a $_GET var that says "url/file.php?sort=date" (or whatever syntax you want), then simply check for that $_GET variable when constructing your query. Link to comment https://forums.phpfreaks.com/topic/169985-sort-by-date/#findComment-896819 Share on other sites More sharing options...
AlbumFiend Posted August 12, 2009 Author Share Posted August 12, 2009 I'm a real beginner when it comes to PHP... so hopefully I'm not asking too much but an example would be nice For the live site, can visit @ www . albumfiend . com Link to comment https://forums.phpfreaks.com/topic/169985-sort-by-date/#findComment-896824 Share on other sites More sharing options...
perrij3 Posted August 12, 2009 Share Posted August 12, 2009 The * selects all information in every field. Table needs to be changed to the name of the table you want to get the information from. after ORDER BY you place the field name you want to have the information sorted by. DESC will place the results in descending order. Hope that helps. Link to comment https://forums.phpfreaks.com/topic/169985-sort-by-date/#findComment-896828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.