ngreenwood6 Posted December 3, 2011 Share Posted December 3, 2011 I have been going in circles about how to handle the issue that I have come up with and was hoping that someone could provide a different method. Basically I want to be able to create an infinite number of categories and allow them to be assigned to other categories then making them subcategories/sub sub categories if you will. My initial plan was to use a method I have used before by just saving the parent id of the subcategories and recursively going through the data. However, I am not to fond of this because of the inefficiency that it provides. I did some research and found that method is called the "Adjacency List". I also found another way to do it called "Nested Sets" which seems to be much more efficient but its a little harder to understand / maintain. I was hoping that someone here could offer alternatives to both of these methods that will allow me to keep the efficiency of "Nested Sets" but providing the ease of use / maintenance of the "Adjacency List". Thanks in advance for any help. Quote Link to comment https://forums.phpfreaks.com/topic/252362-infinite-categories-sub-categories/ Share on other sites More sharing options...
mikosiko Posted December 3, 2011 Share Posted December 3, 2011 this presentation posted by fenway in the "The MYSQL sticky" long time ago is a must to be read... around slide 48 and up apply to your case, specifically slide 68 to 77 show and explain a third alternative "Closure Table" http://www.slideshare.net/billkarwin/sql-antipatterns-strike-back hope that help Quote Link to comment https://forums.phpfreaks.com/topic/252362-infinite-categories-sub-categories/#findComment-1293783 Share on other sites More sharing options...
ngreenwood6 Posted December 3, 2011 Author Share Posted December 3, 2011 Thank you very much. I am going to read it now and will post back with my thoughts. If there are any other suggestions please keep them coming as I think this is one of the most challenging things to handle and keep efficient. Quote Link to comment https://forums.phpfreaks.com/topic/252362-infinite-categories-sub-categories/#findComment-1293785 Share on other sites More sharing options...
ngreenwood6 Posted December 3, 2011 Author Share Posted December 3, 2011 I want to thank you again for the resource. I actually really like the closure table method. There is also alot of other good resources in that article as well. The only part that it doesn't show is how to get a full tree view in a single query which I am working on figuring out now so if you have a solution feel free to post it. Quote Link to comment https://forums.phpfreaks.com/topic/252362-infinite-categories-sub-categories/#findComment-1293804 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.