Jump to content

Categories and Subcategories :


bobtutos

Recommended Posts

Hello everybody, I do need your help on how to create the database(PHP/MYSQL)with categories and subcategories and which sql command(query) is relevant under this situation?. I tried goggling with no success, so please help me out. Your help is much appreciated. Thanks in advance,

Link to comment
Share on other sites

You're talking about a tree structure. The easiest way is a table for categories that has a field to hold the ID of the parent category, although there are other database designs that are more efficient for searching, for example pulling out an entire branch with one query. With the other structure you would need to use recursion to print an entire branch. http://www.google.com/search?client=opera&q=efficient+database+design+for+a+tree+structure&sourceid=opera&ie=utf-8&oe=utf-8&channel=suggest

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...