$query = mysql_query("SELECT *, MAX(date_time) FROM messages
WHERE user_to='$current_user' OR user_from='$current_user'
GROUP BY conversation
ORDER BY date_time DESC LIMIT 0,5") or die(mysql_error());
echo $message['MAX(date_time)'];
How can I display the column ‘content’ that is in the same row as the date_time being selected here, so the time matches with the message? Would it be something like
echo $message['MAX(content)'];
I am trying to have ‘messages’ in groups (called conversations) and I want to display the most recent message. It is currently displaying the most recent time but not the most recent message.
Thanks.
If your table has an autoincrement id column to use as the message id, then the highest id value should also be the latest message in the conversation