With a php site connected to a mysql database, what is the best way to chose the last 3 entries made?
Also, is there a way to sort the results and get like the 5th one?
| SitePoint Sponsor |



With a php site connected to a mysql database, what is the best way to chose the last 3 entries made?
Also, is there a way to sort the results and get like the 5th one?





Assuming you have a timestamp field in your table, you can do this to get the last three entries.
To get the fifth oneCode:SELECT * from tablename ORDER BY timestamp DESC LIMIT 3;
Code:SELECT * from tablename ORDER BY timestamp DESC LIMIT 4,1;
Please don't PM me with questions.
Use the forums, that is what they are here for.
Bookmarks