I am working on a Private Messaging Service (PMS) on my website. This is how my 'message' table on my MySQL database look like.
id sender_id receiver_id message
1 2 3 hi
2 3 2 You good?
3 2 3 sure
4 1 3 hello
5 3 1 yes
Now, i am confused about something. I want that when a user (that is when $_SESSION['id' = 3]) visits the 'message' page, what shows up is the last message from a conversation with the last conversation coming at the top. Something like this:
- Yes
- sure
Then, when the user clicks on for example, 'Yes', he gets to see all the conversation he had with user with id = 2, i.e.
hi
You good?
sure.
Please how do I go about this?