I have have created a Private messaging system using PHP and mySQL with notification a bit like Facebook.
The database table has following fields( not all listed):
- MessageID
- senderUserID
- RecUserID
- Message
- Subject
- DateTime
- Status - whether read or not
- RepliedStatus - how should i use this?
- DeleteRec - delete from inbox
- DelSender - delete sender inbox
- RepliedUserId - When user reply to orginal message this is change to receiver's id
All replies are stored in a second table, since each message create a thread. The second table looks a bit like this:
- messageID - FK
- repuserID
- Mesage
- DateTime
At the moment when a new message is sent out to a user i change the 'status' of the message to unread, From this can run a count query to list all of the unread messages in notification.
But if the users replies back to that message i cant set the original 'status' field to unread, since this will appear on both users notification. so i created another field called 'RepliedStatus ' but i am unsure how would i use this to show notification on message reply?
thanks guys.