3raser Posted February 17, 2012 Share Posted February 17, 2012 I want my forum to sort through the threads from youngest to oldest. How would I go about doing this? I originally used the NOW() function when inserting a new thread, but I had no clue how to make the threads sort via the date. I could use the time() function, but all users would see for the date would be numbers. Each time someone posts, the field "lastpost" is updated to send it to the top of the forum (suppose to). Any ideas? :-\ - I'm just learning the ropes for time and dates with PHP. Quote Link to comment https://forums.phpfreaks.com/topic/257170-php-time-help/ Share on other sites More sharing options...
kicken Posted February 17, 2012 Share Posted February 17, 2012 When you query for the post listing, just use the ORDER BY clause in your query to sort by your date field, in descending order. Quote Link to comment https://forums.phpfreaks.com/topic/257170-php-time-help/#findComment-1318268 Share on other sites More sharing options...
3raser Posted February 17, 2012 Author Share Posted February 17, 2012 When you query for the post listing, just use the ORDER BY clause in your query to sort by your date field, in descending order. MySQL will actually be able to sort via date? Edit: Got it. Quote Link to comment https://forums.phpfreaks.com/topic/257170-php-time-help/#findComment-1318269 Share on other sites More sharing options...
3raser Posted February 17, 2012 Author Share Posted February 17, 2012 Edit: Solved. Quote Link to comment https://forums.phpfreaks.com/topic/257170-php-time-help/#findComment-1318270 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.