Page 1 of 1

Reversing Displayed results from a table

Posted: Thu Nov 19, 2009 7:25 am
by mikes1471
Hey everyone

I've just designed the 'inbox' for my online users to carry out peer to peer messaging through my website and all is working OK, displaying results in a table of the message date, message sender and message subject but typically the newest message is displayed on the bottom row, how can I change this so the more recent messages are at the top?

Re: Reversing Displayed results from a table

Posted: Thu Nov 19, 2009 7:38 am
by vargadanis
Hi,
you need to order the mysql results. I suppose you have something like ID or sent date stored in the table. Try something like:

Code: Select all

$rec = mysql_query("SELECT * FROM `table` ORDER BY `sentData` DESC");
This will put the newest on top.

Regards! :)

Re: Reversing Displayed results from a table

Posted: Thu Nov 19, 2009 7:41 am
by mikes1471
Excellent thankyou!