•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Database Design section within the Web Development category of DaniWeb, a massive community of 373,485 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,938 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Database Design advertiser:
Views: 1070 | Replies: 2
![]() |
•
•
Join Date: Mar 2007
Location: India
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
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
userId=Session("UserId")
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
•
•
Join Date: Apr 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
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 userId=Session("UserId")
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
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.
- Have a bigtext type field int the user table called viewed_posts.
- In php I will have a session variable called 'viewed_posts' or something similar to that effect --> it will be a serialized array
- When the user logs in, it will take the database version of viewed_posts and store it in the session variable.
- When they visit a page, viewed posts will be deserialized into an array and I can work with it from there.
- When they veiw a new post, I just add that post ID to the array, serialize it, store it in both the session and the database.
Thanks for taking a look!
Andrew Arnott
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Database Design Marketplace
- Forum Design: Best for user customization (Web Developers' Lounge)
- Help with comparing user input to a text file! (C++)
- Reputation Points. (DaniWeb Community Feedback)
Other Threads in the Database Design Forum
- Previous Thread: 3NF to BCNF?
- Next Thread: Browser based game, database design


Linear Mode