php-mysql的已读或未读消息状态


Read or unread message status with php mysql

我的网站上有一个消息系统,用户可以在其中相互发送消息,我有一个mysql数据库,其中包含以下列:

 id sentto sentby msgbody created

"sentto"是向其发送消息的人。"sentby"是消息发送者。

我使用select语句在页面上显示消息。

现在,我想在我的消息系统中添加状态函数Read|Read,这样,如果foo向bar发送消息,bar打开收件箱并读取消息,那么foo将在消息的发件箱中看到状态Read。

这怎么可能?

我需要在聊天表中再创建两列"已读"answers"未读"吗?

知道吗?

sentby之后添加一个新列hasread, tiniyint (1), default as 0。当接收器(栏)打开消息更新数据库记录hasread=1时。