jgd12345 Posted September 22, 2007 Share Posted September 22, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/70285-implementing-a-readunread-feature-on-my-forum/ Share on other sites More sharing options...
JJohnsenDK Posted September 22, 2007 Share Posted September 22, 2007 Option one sounds good to me... its the my im doing this on my sites... Quote Link to comment https://forums.phpfreaks.com/topic/70285-implementing-a-readunread-feature-on-my-forum/#findComment-353079 Share on other sites More sharing options...
Dragen Posted September 23, 2007 Share Posted September 23, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/70285-implementing-a-readunread-feature-on-my-forum/#findComment-353122 Share on other sites More sharing options...
jgd12345 Posted September 23, 2007 Author Share Posted September 23, 2007 Hi, cheers i think i'll go for option 1 then. I've been researching on whether it was efficient enough but it appears that it's quite a common way of doing it so i guess it is. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/70285-implementing-a-readunread-feature-on-my-forum/#findComment-353313 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.