Jump to content


Photo

creating subforums or subcategories


  • Please log in to reply
1 reply to this topic

#1 tjhilder

tjhilder
  • Members
  • PipPipPip
  • Advanced Member
  • 136 posts
  • LocationKent, UK

Posted 03 October 2006 - 02:43 PM

Hi,

I have a table called forums

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

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

`subforum` INT(11),

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
`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))

'replies'
`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))

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



#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 03 October 2006 - 03:04 PM

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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users