I have a table like this:
id title parent_id full_path
full_path designed to search for a parent as recursive. Like this:
+----+-----------+-----------+-----------+ | id | title | full_path | parent_id | +----+-----------+-----------+-----------+ | 40 | home | 40 | 0 | | 41 | myhome1 | 41 | 0 | | 42 | **** | 40-42 | 40 | | 43 | ***** | 41-43 | 41 | | 44 | *** | 44 | 0 | | 45 | **** | 45 | 0 | | 46 | ***** | 46 | 0 | | 49 | ****** | 49 | 0 | | 50 | **** ** | 40-42-50 | 42 | | 51 | **** ** | 40-42-51 | 42 | | 52 | **** ** | 40-42-52 | 42 | | 53 | ******* | 40-53 | 40 | | 54 | **** | 40-54 | 40 | | 55 | *** | 41-55 | 41 | | 56 | **** **** | 40-42-56 | 42 | | 57 | ******* | 44-57 | 44 | +----+-----------+-----------+-----------+
How can I get a recursive array as follows:
array ( 40 => array ( 42 => array ( 50,51,52,etc. ), 53, 54 ) 41 => array ( 43, 55, ), 44 => array ( 57, ), etc... )
Is it possible to use full_path to create a multi-level menu?
source share