I'm creating a system where users can write their current status and other users can comment.
If anyone has commented on a user's status the user will get notified, but I'm having an issue coding this behavior.
My desired behavior is this: if i have one comment on my status (by one user, of course):
echo "user has commented your status"
If I have two comments in 2 of my statuses (and the both are from same user):
"user has commented your status" "user has commented your status"
(the text should be printed twice, each for one status)
If I have 3 comments in my 2 statuses (where the 1st status has 1 comment from one user, and the second has 2 by different users)
echo "More than one users has commented your status"
echo "user has commented your status"
So if I have 2 comments in 1 status (where both comments are different user and NOT the same)
echo "More than one users has commented your status"
To summarize: my system should only echo one time for EACH status notification. If its one comment from one user, or more comment in one status, from one user, you will get:
echo "user has commented your status"
but if comments come from different users in one status, you will get:
echo "more than one has commented your status
When a user comments, it also saves in users_msgs
a row, with:
uID | nData | icon
uID
contains the status creator's id (not the id of the user who commented)icon
contains the commenting user's id.nData
contains the status id.
(please do not comment on the names of the columns)
How can I do this? I don't know where to start.
The only thing that I know should be done is that in the query should be uID = '$USER'
(where $USER
is the id of the signed-in user). But how do I check if there's more than one user that has commented per status id (nData
), and if not show a single message of user has commented on your status
.
If something's unclear please comment and I'll update my question.