How many new posts?
Moderator: General Moderators
How many new posts?
I'm working on making a forum, and I'm wondering how would you write a script that would say something like Chat(18 new posts). How would you get how many new posts?
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Everytime a user enters a thread, set a cookie with the current time.
When they visit your site again, have a query like
This requires that after each post is made, you include the current time.
When they visit your site again, have a query like
Code: Select all
$sql = "SELECT COUNT(`id`) AS `total` FROM `posts` WHERE `time` >= '".$cookietime."'";- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Not really, after all this site uses cookiescbrian wrote:Well, I can't use cookies on this site. And this would probablymanually track every post the person has read.
Agreed.Ambush Commander wrote:If you want to manually track every post someone has read, you'll have to do it with some intelligent limiting, else you'll be handling huge files that have information on read and unread posts.
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Meaning if I visit a forum, view one topic, and then leave, it means I effectively viewed ALL topics?Phenom wrote:Everytime a user enters a thread, set a cookie with the current time.
When they visit your site again, have a query like
This requires that after each post is made, you include the current time.Code: Select all
$sql = "SELECT COUNT(`id`) AS `total` FROM `posts` WHERE `time` >= '".$cookietime."'";
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: