I made a wesite which have a webforum something like this site. Where a user can send message to each other. i am using php-mysql. i want to know how to store info about if user had read his message or its still unread. my site is www.thar.co.

mysql table-column for message are: message_id, message-by, message-to, message-body, message-date

Sorry for bad English hope i made my point.

Recommended Answers

All 2 Replies

Member Avatar for diafol

Add two fields to the message table: status_by, status_to - where 0 = visible, 1 = deleted for status_by and 0 = unread, 1 = read, 2 = deleted for status_to.

So the sender (by) can choose to delete the message from his 'sent' box - but it's still in the system so that recipient (to) can still see it. If just deleted from DB, the recipient would also lose the message. Similarly for the recipient. This method may allow the sender to see the unread/read status of the message with regard to the recipient if you want to allow that. Somehow I don't like that as it suggests 'spying'.

thank you sir,
i will implement this, thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.