stevesimo Posted July 31, 2007 Share Posted July 31, 2007 Hi, I want to return the last 3 records added to my table called towns. sql = "select * from towns limit 3" This only returns the first three rows, I want the last 3. My primary key field is townID Thanks Steve Quote Link to comment https://forums.phpfreaks.com/topic/62632-return-last-3-records/ Share on other sites More sharing options...
hostfreak Posted July 31, 2007 Share Posted July 31, 2007 sql = "SELECT * FROM towns ORDER BY townID DESC LIMIT 3"; Quote Link to comment https://forums.phpfreaks.com/topic/62632-return-last-3-records/#findComment-311741 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.