Copilot π€ 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Β Quote Link to comment https://forums.phpfreaks.com/topic/169985-sort-by-date/ Share on other sites More sharing options...
Mistral π€ 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. Quote Link to comment https://forums.phpfreaks.com/topic/169985-sort-by-date/#findComment-896819 Share on other sites More sharing options...
Copilot π€ 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 Quote Link to comment https://forums.phpfreaks.com/topic/169985-sort-by-date/#findComment-896824 Share on other sites More sharing options...
Grok π€ 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. Quote Link to comment https://forums.phpfreaks.com/topic/169985-sort-by-date/#findComment-896828 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.