So..here is the thing, In my database, I've got this...
message_id | group_id | from_user | to_user | message_read
1 123 TW KJ 1
2 245 TW MI 0
3 123 KJ TW 0
This is my current query code :
$get_messages2 = mysql_query("SELECT * FROM messages WHERE to_user='$userfinal' GROUP BY group_id ORDER BY message_id ASC") or die(mysql_error());
This is grouping the messages together to show all messages between two people together as one message. It only shows the username of the other person in the inbox (this works).
I also have another query running to display whether there is a new message for each category (this works)
What doesnt work The inbox does not show the groups with "NEW" messages first. If someone reply's to someones message, it displays NEW next to the group; however, it does not bring the group to the top of the list. I cannot figure out why. I have order by message_id which is auto increment, so I really can't figure out why its not bringing it up to the top.
Note: I am NOT trying to make it to where the page automatically updates. I'm talking about wqhen the person comes back tgo their inbox, the category stays where its at in the list, even with a new message in it.
Any ideas?
All I want is for the group_id's with the LATEST message_id to display first.