Reputation: 2379
I've written a small task management system to allow a client to add tasks to, then I can mark their completion, time taken, etc, and to keep track of messages about each task.
I want to notify of new messages but I'm not sure the best way to do this. I don't want to have the client have to "mark as read", but visiting the messages page should act as marking as read. How should I go about doing this? It's simple PHP and MySQL.
I thought the best way would be to add a field to the messages table called "read" and have it default to 0 and any messages which are displayed by the "view messages" page marks them as 1 (read). So if I leave a message, it'll be 0 until the messages page is viewed and I can then use that to find unread messages and display them on the index page. Does this sound flawless? Can you foresee any issues or think of a better way?
Thanks.
Upvotes: 0
Views: 1231
Reputation: 46
for me it seems ok. but when you want to see what messages are unread use ajax lets say every 5 min.that way you can update the list of unread messages. hope makes improvment in your concept
Upvotes: 1
Reputation: 2045
Either use separate field to note if the message was viewed or trace 'last visit' time and calculate if the messages was added later.
Upvotes: 2