ohdang888 Posted January 1, 2008 Share Posted January 1, 2008 hey. in my database, next to the name of the game, it says the date added. what do i put in my query to order it so that the most recent is first. my code so far is below: $result = mysql_query("SELECT `title` FROM game ORDER BY `date_added` LIMIT 10") Quote Link to comment https://forums.phpfreaks.com/topic/84007-solved-how-to-order-by-date-added/ Share on other sites More sharing options...
trq Posted January 1, 2008 Share Posted January 1, 2008 SELECT `title` FROM game ORDER BY `date_added` DESC LIMIT 10 Quote Link to comment https://forums.phpfreaks.com/topic/84007-solved-how-to-order-by-date-added/#findComment-427487 Share on other sites More sharing options...
ohdang888 Posted January 1, 2008 Author Share Posted January 1, 2008 but... how woudl i need to write the date? 1-1-08 and wouldn't oit just pick it form the first number? HAPPY NEW YAER! Quote Link to comment https://forums.phpfreaks.com/topic/84007-solved-how-to-order-by-date-added/#findComment-427500 Share on other sites More sharing options...
trq Posted January 1, 2008 Share Posted January 1, 2008 how woudl i need to write the date? The easiest way is to use mysql's NOW() function. Quote Link to comment https://forums.phpfreaks.com/topic/84007-solved-how-to-order-by-date-added/#findComment-427504 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.