确定论坛中的未读项目 [英] Determining unread items in a forum

查看:61
本文介绍了确定论坛中的未读项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PHP和MySQL,我正在尝试构建一个论坛系统.我想知道的是,如何设置它,以便当用户阅读某个论坛条目时,无论该用户所在的论坛是什么,它都将显示为该用户的已读状态,直到其他人在该论坛上发帖为止.

当前,对于每个线程,我都有一个带有PostID的表,并具有将其发布的UserID,将其链接到的ThreadID,实际的Post(作为文本),然后是其发布的日期/时间. /p>

对于每个论坛中的话题列表,都有threadID(主键),ThreadName,它所属的ForumID,NumPosts,NumViews,LastPostDateTime和CreateDateTime.有帮助吗?

解决方案

当用户读取该线程时,它可能存储在另一个表中,用户ID,线程ID,LastReadDateTime.

if (LastPostDateTime > LastReadDateTime) you got an unread post.

可悲的是,您的开销很大,每次读取都会有一个写入.

Using PHP and MySQL, I have a forum system I'm trying to build. What I want to know is, how can I set it so that when a user reads a forum entry, it shows as read JUST for that user, no matter what forum they are in, until someone else posts on it.

Currently, for each thread, I have a table with a PostID, and has the UserID that posted it, the ThreadID to link it to, the actual Post (as Text), then the date/time it was posted.

For the thread list in each forum, there is the threadID (Primary Key), the ThreadName, ForumID it belongs to, NumPosts, NumViews, LastPostDateTime, and CreateDateTime. Any help?

解决方案

May be storing in another table UserID,threadID, LastReadDateTime when the user read that thread.

if (LastPostDateTime > LastReadDateTime) you got an unread post.

Sadly you have a great overhead, on every read you'll have a write.

这篇关于确定论坛中的未读项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆