Page 1 of 1

[SOLVED]forum db implementation

Posted: Sun Feb 05, 2006 10:24 am
by rubberjohn
Hi,

I'm workign on a project that requires a private 'forum' style communications between two users.

I was just wondering what is that standard database table design for forums? Im only asking about the way that posts are handled not all of the user data.

Is there just one table where the posts are identified by an id number and then reply posts are linked to this id number but differentiated by their order number?

IE

Original post (new thread) - POST ID, AUTHOR etc
Reply - POST ID, AUTHOR, REPLY NUMBER (1)
Reply - POST ID, AUTHOR, REPLY NUMBER (2)

...and so on.

Or is it more complicated than this?

Thanks

rj

Posted: Sun Feb 05, 2006 10:27 am
by feyd
most that I've seen use a single table for all posts. There is another table for thread identification, which simply has a subject field, and a few other bits specific to threads that posts do not share. Posts store the rest of the information, which may include subject, various settings, the post it is in reply to, the post text, and so forth.

Posted: Sun Feb 05, 2006 10:57 am
by rubberjohn
ok cheers thats cleared that up.

what would be the best way to secure the forum. the way it will work is that one user will view anothers profile and leave them a message. the system will only allow the two users to communicate in that particular thread.

is it enough just to include the author and the recipient in the original thread submission to the database table and then check the credentials of the user against that table when they try to either read or submit to the thread?

thanks again

rj

Posted: Sun Feb 05, 2006 1:57 pm
by feyd
that should be fine.

Posted: Sun Feb 05, 2006 3:21 pm
by rubberjohn
ok cheers for that - it was pretty much as i thought but i just wanted ot check there wasnt any implications i hadnt thought of