![]() |
| ||
| Storing if a user has viewed a post I'm making a forum-like program, and I'm having difficulty designing a particular feature. I want it to store if a user has viewed a particular post or not. I'm not sure exactly how to go about this. What do you think would be the best approach? Thanks, Andrew Arnott |
| ||
| Re: Storing if a user has viewed a post Hi, Well this is a possible solution: 1. Make a Table say tblForumView with Following fields: ID UserId lastVieweddate 1. On Login Page, store the User's ID (UserId) in a Session Variable. 2. On the Forum Page in the Page Load Event, check if this userID exists in tblForumView table by saying something like select count(*) from tblForumView where Now, if the above query returns 0 then this userId has not made any views of this page. So you insert a record for this userId in the table tblforumview. On the other hand , if count>0 then this UserID has visited eralier, so just update the field [lastVieweddate] with current date and time. Storing a [lastVieweddate] will allow you to remind the user as to when he last visited the page. And also enable you to do some other cool things like for example, You can display Alll the New Posts which have been posted since his last visit to the forum. Regards, Nitin |
| ||
| Re: Storing if a user has viewed a post Quote:
Thanks for the reply -- great idea. I have to do something slightly different however. I need to know exactly which pages have not been viewed (rather than just showing which have not been viewed since the last visit). Here is my current idea... I'm not sure if it is a bad idea or not though.
Thanks for taking a look! Andrew Arnott |
| All times are GMT -4. The time now is 9:26 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC