faqts : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

12 of 16 people (75%) answered Yes
Recently 1 of 2 people (50%) answered Yes

Entry

How do I go about creating a nested forum?

Jul 19th, 2004 23:26
Alder Rus, Alok Sinha, Jonatan Bagge, unknown unknown, http://www.directoryonclick.com , http://www.singapore-yellow-pages.com


One of the ways to go about doing this is to treat the nests as 
categories with mother-daughter relationship.
I would use a database with strucutre like this (very basic)
desc_id
desc
master_id
other_fields
Every article posted has an auto incremented id, and along with this 
also store the master_id, that is actually the id to which this 
comment 
is a reponse to.
An example table will look like.
id  desc                        master_id
1   msg one                        0 
2   msg two                        0
3   comment to msg one             1
4   comment to above               3
5   comment to msg two             2
6   comment to comment to msg one  3