forumnz Posted January 1, 2008 Share Posted January 1, 2008 Am I on track here: There is a Parent ID and an ID (the ID becomes the Parent ID for the next thing down and so on). So the DB may look like: PID ID 1 1 1 2 1 3 2 4 3 5 3 6 3 7 4 8 5 9 Thanks, Sam. Quote Link to comment https://forums.phpfreaks.com/topic/83919-solved-heirarchy-stuff/ Share on other sites More sharing options...
p2grace Posted January 1, 2008 Share Posted January 1, 2008 In order to answer whether or not you're on track we need to know exactly what it is you're trying to accomplish. Doing it the way you are will allow you to assign subcategories to categories (assuming they are for categories). If that's what you are trying to accomplish then I'd say yes you're on track. Quote Link to comment https://forums.phpfreaks.com/topic/83919-solved-heirarchy-stuff/#findComment-427070 Share on other sites More sharing options...
forumnz Posted January 1, 2008 Author Share Posted January 1, 2008 Thanks - that is what I'm doing. Something I am confused with though, is how does the second sub-category fit in? Thanks, Sam. Quote Link to comment https://forums.phpfreaks.com/topic/83919-solved-heirarchy-stuff/#findComment-427073 Share on other sites More sharing options...
p2grace Posted January 1, 2008 Share Posted January 1, 2008 You'll just keep doing it the way you are. Here what the theory would be: 1. Grab all categories whose parent id is 0 or null 2. Grab all categories who parent id is one of the categories from step 1. 3. etc. Quote Link to comment https://forums.phpfreaks.com/topic/83919-solved-heirarchy-stuff/#findComment-427075 Share on other sites More sharing options...
forumnz Posted January 1, 2008 Author Share Posted January 1, 2008 Ahh! Now I get it thanks! Quote Link to comment https://forums.phpfreaks.com/topic/83919-solved-heirarchy-stuff/#findComment-427077 Share on other sites More sharing options...
p2grace Posted January 1, 2008 Share Posted January 1, 2008 If it works would you mind clicking the "Topic Solved" button. Quote Link to comment https://forums.phpfreaks.com/topic/83919-solved-heirarchy-stuff/#findComment-427084 Share on other sites More sharing options...
forumnz Posted January 1, 2008 Author Share Posted January 1, 2008 oops! sorry! Quote Link to comment https://forums.phpfreaks.com/topic/83919-solved-heirarchy-stuff/#findComment-427086 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.