Hi!
I want to create an image gallery, that may include more then 4 sub-categories inside each other. For example:
Arhitecture->Maryland->Baltimore->Downtown->Old Houses
What would be a good way, how to save it in the database? do I need to have seperated table for each sub-category or should I use one table? any other suggestions? Thanks!
Category/Sub-Category/Sub-Sub-Category
Moderator: General Moderators
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
You don't need separate table to do this. You can achieve this with the help of single table.
Make the table with the following attributes :
is_parent if 0 then it is root. And if it is not 0 and contains a parent node id which will becomes a child of parent node with that value.
I guess that makes a concept of what you are trying to archive.
Make the table with the following attributes :
Code: Select all
cat_id
cat_name
is_parentI guess that makes a concept of what you are trying to archive.