1

I'm developing a site and I need a way of selecting only one newest message from the database and show to the current user like in facebook.

When the user clicks on the message, then the rest of the messages (if any) are loaded. Here is the database query photo:

enter image description here

How do I make only one message from e.g sender 75e928ac97dd17360a7890d6 to be rendered to recipient AmoloCaleb?

UPDATE: Thi is the sql code:

$stmt = "SELECT  msg,sender FROM chat WHERE sender IN (SELECT DISTINCT sender from chat WHERE recipient=?)";

0 Answers0