Ok, in my PM income list I have this:
$queryIn = "SELECT * FROM users_pm_in WHERE uID = '$USER' ";
Take's all queries and shows them. Now everytime user creates a PM, he creates a "dialog_id" number. If the recipient respond to the userÂ´s PM, the recipientÂ´s PM will also have that number in dialog_id.
So, that's why I would only want to show 1 entry in the income, per dialog_id. How it looks in users_pm_in:
id | uID | bID | msg | dialog_id -------------------------------- 1 | 1 | 2 | Hello | 1 2 | 2 | 1 | Hi? | 1 3 | 1 | 2 | Wazzaa? | 1
uID is who is receiving the message, bID is the user who sended it, msg is message, dialog_id shows that they are writing in the same dialog all the same(they responded eachother).
So if I am id 1, in my income list I would have 2 entrys right now, with the query above.
What I want to have, is only 1 IF it's the same dialog (dialog_id and same bID)
And the 1 that it is showing should be the one order by date desc
SELECT * FROM users_pm_in WHERE uID = '$USER' GROUP BY dialog_id ORDER BY id DESC
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki