Can someone please tell me how i would retrieve the last five rows in a mysql table. It is to get the five most recent entries.
Thanks
The problem is that we can't be sure that the last 5 rows are the 5 most recent ones, you need a datetime field for that
SELECT ... FROM ... WHERE .... ORDER BY DateInsert DESC
what Wien said was correct but if you are sure that the last 5 data in your table is the latest one, then... use LIMIT.
example:
$sql="SELECT newsTitle FROM news ORDER BY newsId DESC LIMIT 5";