narjis Posted March 9, 2012 Share Posted March 9, 2012 I am extracting an array from the database in sorted form with respect to it's parent_id. Now I have to make a sub tree of this array in such a way that related nodes would be inserted in 'pages' field. cleths->upper->shirts Quote Link to comment Share on other sites More sharing options...
silkfire Posted March 9, 2012 Share Posted March 9, 2012 You're asking how to build a tree from a parent / children array. This problem has been documented many times, here's a very good tutorial. try to use the non-recursive function for efficiency. http://www.tommylacroix.com/2008/09/10/php-design-pattern-building-a-tree/ Quote Link to comment 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.