Jump to content

Recommended Posts

Hi, i'm in the process of building my own small forum.  One of the features i feel i can't live without is displaying the read/unread posts icon next to each topic.  I thought of a couple ways of doing this but none seem good enough:

 

1. Create a table in my database to store the topic id and the user id for each topic a user views.  This will easily allow me to detect whether a user has viewed a topic.  However this could lead to a potentially massive table.

 

2. Create a cookie for each post a user views but again this could create to too many cookies.

 

As you can see neither of my ideas seem to work.  Really appreciate it if someone could suggest an alternative.

I'd agree with Johnsen. Then you can make a simple check of the database to see which ones have been read.

The problem with cookies is they can be deleted.. then all of the posts will look unread to the user.

 

Another method with a database may be to have an extra column in the posts table which contains a list of all the user id's which have viewed that post, separated by a symbol or even a ','. Although then you'd have to explode the results and search it. Separate table would probably be best!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.