Categories and subcategories setup

Kcweir

Registered User.
Local time
Today, 23:46
Joined
Aug 26, 2003
Messages
10
I am setting up a database of vendors for my company. Each vendor needs to be classified as belonging in a certain category and/or subcategory. I also need to make it possible for each vendor to belong in multiple categories as well. For example, Smith Masonry would be listed under the category of Subcontractor, the subcategory of Mason but also may be listed under the category of Block Supplier as well. I need the user to be able to search under any of those categories to come up with this vendor.

Here are my questions about setting this up:
Do I need a field in my Vendors table for each category/subcategory that belongs to the vendor?

Can I make it so that some categories have subcategories but not all?

Can I make it so that you do not have to choose a subcategory even if one is available?

Any help with this is greatly appreciated.
Kimberly
 
Kimberly, your question is a very common one. You may wish to try searching these forums first, but I can tell you that if you go to the PHP forum at forums.devshed.com and do a search, you will find many threads explaining how to setup such a scheme. In a nutshell, you will need something like this:


CATEGORY_NAMES
-----------------------
category_ID
category_name


CATEGORIES
----------------
subcategory_ID
parent_category_ID
category_ID


VENDORS
------------
vendor_ID
. . .


VENDORS_CATEGORIES
-----------------------------
subcategory_ID
vendor_ID
 

Users who are viewing this thread

Back
Top Bottom