w1ww Posted July 16, 2008 Share Posted July 16, 2008 Hello, I'm here stuck on this query: $q = "SELECT * FROM mensagens WHERE codSala='$sala' ORDER BY data ASC" I want to get the last 10 results ordered by date where the 1st result is the oldest and the last one is the latest. How can I done that? Thank you Link to comment https://forums.phpfreaks.com/topic/115109-phpmysql-get-last-results/ Share on other sites More sharing options...
simon551 Posted July 16, 2008 Share Posted July 16, 2008 $q = "SELECT * FROM mensagens WHERE codSala='$sala' ORDER BY data ASC LIMIT 10"? Link to comment https://forums.phpfreaks.com/topic/115109-phpmysql-get-last-results/#findComment-591961 Share on other sites More sharing options...
w1ww Posted July 16, 2008 Author Share Posted July 16, 2008 It does not work (thank you for trying). What I get is the first 10 results and not the last ones of the database. Link to comment https://forums.phpfreaks.com/topic/115109-phpmysql-get-last-results/#findComment-591972 Share on other sites More sharing options...
slushpuppie Posted July 16, 2008 Share Posted July 16, 2008 ORDER BY data DESC Link to comment https://forums.phpfreaks.com/topic/115109-phpmysql-get-last-results/#findComment-591984 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.