Jump to content

Archived

This topic is now archived and is closed to further replies.

tjhilder

creating subforums or subcategories

Recommended Posts

Hi,

I have a table called forums

[code]
`forum_id` INT(11) NOT NULL AUTO_INCREMENT,
`title` VARCHAR(100) NOT NULL,
`subtitle` TEXT NOT NULL,
PRIMARY KEY (forum_id))
[/code]

which works well. but now I want to add sub forums, so I thought I would do it this way:

[code]`subforum` INT(11),[/code]

but it seems doing a value of (forum_id being 2 would mean subforum's going in forum_id 2 would be that X

but no idea how to group them, since I already group them by forum_id.

I have these tables also:

topics
[code]
`topic_id` INT(11) NOT NULL AUTO_INCREMENT,
`date` datetime NOT NULL,
`title` VARCHAR(100) NOT NULL,
`article` TEXT NOT NULL,
`views` INT(11) NOT NULL,
`member_id` INT(11) NOT NULL,
`forum_id` INT(11) NOT NULL,
PRIMARY KEY (topic_id))
[/code]

'replies'
[code]
`reply_id` INT(11) NOT NULL AUTO_INCREMENT,
`date` datetime NOT NULL,
`article` TEXT NOT NULL,
`member_id` INT(11) NOT NULL,
`topic_id` INT(11) NOT NULL,
PRIMARY KEY (reply_id))
[/code]

so I'm wondering if better to do a table called subforums instead? would this work better or is there a sollution to my already made table?

thanks for reading.
--
TJ

Share this post


Link to post
Share on other sites
Well, since every sub-forum is in a forum, it sounds like you need another table to relate sub-forums to forums, and then simply leave forum_id as is, and look up the parent elsewhere if necessary.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.