Hello all . . .
I have a general question on about how to design a table.
The problem is :
I like to create my own web directory.
The directory must have general categories such as Vecation, Medical, etc.
Each of the general categories must have it's own sub categories and each sub category must have it's own sub category and so on for n levels of sub categories.
Normaly if i knew from now how many sub categories i need then i had to create this amount of tables for each sub category.
The question is :
if i create this table for example
|___________________________________________________|
|_cat_id___|_cat_name_______________|_parent_id_____|
|___________________________________________________|
|____1_____|_Vecation_______________|______0________|
|____2_____|_Medical________________|______0________|
|____3_____|_Cars & Bikes___________|______0________|
|____4_____|_Factories______________|______0________|
|____5_____|_Hotels_________________|______1________|
|____6_____|_Maps___________________|______1________|
|____7_____|_Organizations__________|______1________|
|____8_____|_Agents_________________|______1________|
|____9_____|_Hotel ABC______________|______5________|
|____10____|_Hotel DEF______________|______5________|
|____11____|_Cars___________________|______2________|
|____12____|_Bikes__________________|______2________|
|____13____|_BMW____________________|______11_______|
|___________________________________________________|
The cat_id is the category ID
The cat_name is the category name
and the Parent ID is the category id of the parent category.
Is that correct or not ? ? ?
http://www.web-resources.eu