tjhilder Posted October 3, 2006 Share Posted October 3, 2006 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 Link to comment https://forums.phpfreaks.com/topic/22876-creating-subforums-or-subcategories/ Share on other sites More sharing options...
fenway Posted October 3, 2006 Share Posted October 3, 2006 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. Link to comment https://forums.phpfreaks.com/topic/22876-creating-subforums-or-subcategories/#findComment-103094 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.