PDA

View Full Version : How to store dynamic options


logictrap
04-14-2008, 09:53 PM
I am working on a news system that has a dynamic list of categories. I want to be able to have articles that can appear in multiple categories.

Currently there is a table setup to manage the categories where each category has a title and a numeric id.

I need some advice finding a method for assigning multiple categories to an article and then how to retrieve articles based on individual category ids.
(ie can the categories be stored in a single field? if so, what is the correct data type?)

Any help is appreciated.

Thanks - LT

Fumigator
04-14-2008, 10:22 PM
Not a good idea to store a bunch of categories in a single field. You want to store the relationships between articles and categories in its own table. Read Guelphdad's article (http://www.guelphdad.wefixtech.co.uk/sqlhelp/lists.shtml) on normalizing data for the right way to do this.

logictrap
04-15-2008, 02:06 PM
Thank you - I was not familiar with this method.