How to make notification to group users with read/unread flag?
- by user2335065
I am making a notification system so that when users in a group perform an action, it will notify all the other users in the group. I want the notification to be marked "read" or "unread" for each user of the group. With that, I can easily retreive any unread notification for a user and display it. I am think about creating a notification table that have the following fields.
+----------------------+
| notification |
+----------------------+
| id |
| userid |
| content |
| status (read/unread) |
| time |
+----------------------+
My question is:
Whether it is the correct way of making the system? As it means that when there is 1,000 users in a group, then I have to insert 1,000 rows to the table. If not, what is the better way of doing this?
If it is the way to do this, how can I write the php/mysql codes to do the looping of inserting the rows?
Thanks!