In MySQL, I store categories this way:
categories: - category_id - category_name - parent_category_id
What would be the most efficient way to generate the trail / breadcrumb for a given category_id?
For example breadcrumbs(category_id): General > Sub 1 > Sub 2
There could be in theories unlimited levels. I'm using php.
UPDATE: I saw this article (http://dev.mysql.com/tech-resources/articles/hierarchical-data.html) about the Nested Set Model. It looks interesting, but how would you ago about dynamically managing categories? It looks easier on paper, like when you know ahead of times the categories, but not when the user can create/delete/edit categories on the fly ... What do you think?