phpSensei Posted August 22, 2007 Share Posted August 22, 2007 if I wanted to get one row from a table, but I wanted the row that is the most up to date, would I have to do this? $sql=mysql_query("SELECT * FROM table ORDER BY date ASC") // The Newest Record $row=mysql_fetch_assoc($sql); Quote Link to comment https://forums.phpfreaks.com/topic/66238-how-to-get-the-first-row-and-order-by-date/ Share on other sites More sharing options...
Zane Posted August 22, 2007 Share Posted August 22, 2007 To get only the first row you'd do SELECT * FROM table ORDER BY date LIMIT 1; Quote Link to comment https://forums.phpfreaks.com/topic/66238-how-to-get-the-first-row-and-order-by-date/#findComment-331299 Share on other sites More sharing options...
phpSensei Posted August 22, 2007 Author Share Posted August 22, 2007 Yeah But i want the latest date in that row also. Quote Link to comment https://forums.phpfreaks.com/topic/66238-how-to-get-the-first-row-and-order-by-date/#findComment-331308 Share on other sites More sharing options...
Barand Posted August 22, 2007 Share Posted August 22, 2007 to get newest/latest SELECT * FROM table ORDER BY date DESC LIMIT 1; Quote Link to comment https://forums.phpfreaks.com/topic/66238-how-to-get-the-first-row-and-order-by-date/#findComment-331321 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.