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); 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; 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. 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; 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
Archived
This topic is now archived and is closed to further replies.