How to get the last 15 records from a MySQL table in the right order
Posted on 2004-11-30
I have a MySQL table called "messages" which has two fields : name and message.
Now I need an example how to query this table and only fetch the LAST 15 records in (I guess) reverse order.
For example, when I have 1500 records:
The result must be one string containing record 1486, 1487, 1488 and so on: FIELD "name" + "some text" + field "MESSAGE" + " some text".
The idea is that people can enter a name and some short text in two fields on a webpage. Those fields are stored correctly into the table.
Now I need to display only the last 15 messages in chronological order, so last placed message last.