Project Forum

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bjugis
Forum Newbie
Posts: 6
Joined: Fri Nov 29, 2002 5:08 am

Project Forum

Post by bjugis »

I'm makeing a forum now and I wonder if someone have an idea about a effective way saving wich topics each member have seen :?:

If I make one field for each user and one row for all topics it would be very ineffective I think or what ?

I'm greatefull for ideas :D
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

do you want to simply mark the read topics like this board does? Then take a look at the file viewforum.php of the phpBB-package
It's starting at
//
// Handle marking posts
//
otherwise if you want to keep tracks within the db a simple table like

Code: Select all

`userId` int(10) unsigned NOT NULL,
`postId` int(10) unsigned NOT NULL,
`lastview` timestamp(14) NOT NULL
will do.
zacky
Forum Newbie
Posts: 19
Joined: Fri Nov 29, 2002 6:08 am

Post by zacky »

and that's the best way to do it? or?
BradC
Forum Newbie
Posts: 1
Joined: Sun Dec 08, 2002 8:19 pm
Location: Indianapolis, Indiana
Contact:

Post by BradC »

maybe if you create an extra table like you were saying, which a row for each user. Which is created when a new user registers, it creates the row in the user table and in the user_log table or whatever you want to call it.

Then you or I invision it being something like, adding to a field.. everytime they view a thread or however you want to make it, it gets added to that filed (threads_viewed).. which will hmm.. be interesting to say the least, like an if .. blank, add on, if not blank add a comma then the next number..

then when you want to extract to do whatever you want to do, you will have to use explode() function to show what threads the user viewed.

I am not the best with the explode function, which I would like someone to explain to me how it works... and maybe I can better help answer this.. by playing with it myself, since I am making my own forums :)

$forums_viewed = "1,2,3,6,8,9";
.. how do you get the output to do what you want when you use..

$dosomething = explode($forums_viewed);

is it like :

$dosomething[1] = "1";
... blah blah.?

I was also trying to come up with a clever if not efficient, or heck just a way to be able to display what new topics so and so has not viewed since their last visit, then I can go on from there with what old posts have been updated since last been viewed.
Post Reply