2

I need to build a hierarchical list in a website. There are four levels of information:

Categories > Types > Sections > Topics

the id of category is a foreign key for types, the id for types is a foreign key for sections, the id for sections is the foreign key for topics.

This structure seemed necessary as there are pages for each of those four kinds of levels. The pages each display the information in each part as well as the children parts.

Meaning, you could visit http://localhost/community/category.php?id=1 (or any number between 0 and 20ish) and http://localhost/community/types.php?id=3 etc for each of the other two kinds of information as well.

Could i build a hierarchical list with this sort of structure or would i have to do it like a traditional hierarchical mysql structure?

5
  • I've posted this link more than once before: mikehillyer.com/articles/managing-hierarchical-data-in-mysql Commented Jul 30, 2012 at 4:25
  • @Dagon Which method do you feel is the best for general use?? Commented Jul 30, 2012 at 4:32
  • I have always used the The Adjacency List Model; as long as one of the listed limitations is not going to be an issue with your particular data set. Commented Jul 30, 2012 at 4:37
  • ill look into that one, time to completely rebuild the structure of my site haha. thanks though Commented Jul 30, 2012 at 4:40
  • @Dagon, if you put that comment as an answer to the question ill give you the points haha Commented Jul 30, 2012 at 19:32

1 Answer 1

2

I've posted this link more than once before: mikehillyer.com/articles/managing-hierarchical-data-in-mysql ...

I have always used the The Adjacency List Model; as long as one of the listed limitations is not going to be an issue with your particular data set

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.