maxudaskin Posted April 18, 2011 Share Posted April 18, 2011 Hi guys, I'm still stuck on making this multi-level drop down menu, so I figure that I'll listen to how you guys would do it. I don't necessarily need any code, but just ideas on how to code it. Basically, I need it to store each item in a database. It needs to: be accessed, processed, and formatted with PHP end up returning either a multi-dimensional array, or the raw HTML. Examples: <?php array( array( 'label'=>'Test', 'link'=>'index.php?r=test', 'sort'=>0, 'children'=>array(--blah blah blah--) ), array(--blah blah blah--) ); <div id="menu"> <ul> <li><a href="index.php?r=test"><h2>Test</h2></a> <ul> <li><a href="blah">Blah</a> <ul> <li><a href="blah">Blah</a></li> </ul> </li> </ul> </li> </ul> </div> That's pretty much it. If you have any ideas or suggestions, please feel free to help me out. Thank you guys! Quote Link to comment https://forums.phpfreaks.com/topic/234097-creating-a-multi-dimensional-array-from-db/ Share on other sites More sharing options...
maxudaskin Posted April 19, 2011 Author Share Posted April 19, 2011 I hate to bump this topic, but I am starting to get desperate. Anyone got any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/234097-creating-a-multi-dimensional-array-from-db/#findComment-1203290 Share on other sites More sharing options...
Skewled Posted April 19, 2011 Share Posted April 19, 2011 http://bytes.com/topic/php/answers/835140-mysql-table-php-multidimensional-array http://www.brainbell.com/tutors/php/php_mysql/Multidimensional_Arrays.html Check this out see if it points you in the right direction. Quote Link to comment https://forums.phpfreaks.com/topic/234097-creating-a-multi-dimensional-array-from-db/#findComment-1203293 Share on other sites More sharing options...
maxudaskin Posted April 19, 2011 Author Share Posted April 19, 2011 http://bytes.com/topic/php/answers/835140-mysql-table-php-multidimensional-array http://www.brainbell.com/tutors/php/php_mysql/Multidimensional_Arrays.html Check this out see if it points you in the right direction. Doesn't quite help. I understand the concept of multi-dimensional arrays. I'm trying to get the information from my database (effectively a two dimension array (Dim1: Row, Dim2: columns) into a variable dimension array (Items and children [and children's children, ect]). Quote Link to comment https://forums.phpfreaks.com/topic/234097-creating-a-multi-dimensional-array-from-db/#findComment-1203296 Share on other sites More sharing options...
Skewled Posted April 19, 2011 Share Posted April 19, 2011 http://stackoverflow.com/questions/3261069/how-to-grab-mysql-data-into-a-multidimensional-array Perhaps this will be more helpfull Quote Link to comment https://forums.phpfreaks.com/topic/234097-creating-a-multi-dimensional-array-from-db/#findComment-1203301 Share on other sites More sharing options...
maxudaskin Posted April 19, 2011 Author Share Posted April 19, 2011 http://stackoverflow.com/questions/3261069/how-to-grab-mysql-data-into-a-multidimensional-array Perhaps this will be more helpfull I don't think you quite understand what I'm trying to do. The array can have as many levels as the user wants it to. The database has all of the items as a separate row. If an item is a child of another item, it must be places as a sub array to that item. If there is a child to that sub-array, it must be placed as a sub-array to the sub-array (and so on). Quote Link to comment https://forums.phpfreaks.com/topic/234097-creating-a-multi-dimensional-array-from-db/#findComment-1203302 Share on other sites More sharing options...
dcro2 Posted April 19, 2011 Share Posted April 19, 2011 http://wizardinternetsolutions.com/web-database-design/dynamic-multilevel-css-menu-php-mysql/ Quote Link to comment https://forums.phpfreaks.com/topic/234097-creating-a-multi-dimensional-array-from-db/#findComment-1203318 Share on other sites More sharing options...
maxudaskin Posted April 19, 2011 Author Share Posted April 19, 2011 http://wizardinternetsolutions.com/web-database-design/dynamic-multilevel-css-menu-php-mysql/ I think that is exactly what I was looking for... thanks Quote Link to comment https://forums.phpfreaks.com/topic/234097-creating-a-multi-dimensional-array-from-db/#findComment-1203319 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.