kickassamd Posted March 19, 2008 Share Posted March 19, 2008 Im confused on storing a menu system with a parent \ child relationship in mySQL and how to retreive and display it. Example... MAIN---- ---- SUBITEM ---- SUBITEM MAIN---- ----- SUBITEM etc etc. Thanks guys! Link to comment https://forums.phpfreaks.com/topic/96957-menu-system-with-mysql/ Share on other sites More sharing options...
dmccabe Posted March 19, 2008 Share Posted March 19, 2008 Sure you would have 2 tables? One with parent and one with child menus then have the display the parent manue and any child menu with the parent's ID? Something like: tbl_parent -pid -pname tble_child -cid -pid -name I am no tables expert but that is how I would approach it. Link to comment https://forums.phpfreaks.com/topic/96957-menu-system-with-mysql/#findComment-496226 Share on other sites More sharing options...
kickassamd Posted March 19, 2008 Author Share Posted March 19, 2008 1 table id, label, link and parent id and order Link to comment https://forums.phpfreaks.com/topic/96957-menu-system-with-mysql/#findComment-496241 Share on other sites More sharing options...
helbom Posted March 19, 2008 Share Posted March 19, 2008 tbl_menu -id -name -link -cid ------------------------------------ | id | name | link | cid | ------------------------------------ | 1 | home | home.php | 0 | | 2 | sub | hsub.php | 1 | | 3 | new | new.php | 0 | |4 | newsub| nsub.php | 2 | ------------------------------------ did it make any sense? Link to comment https://forums.phpfreaks.com/topic/96957-menu-system-with-mysql/#findComment-496257 Share on other sites More sharing options...
kickassamd Posted March 19, 2008 Author Share Posted March 19, 2008 Yeah i have the db structure... Just lost on the PHP end. Link to comment https://forums.phpfreaks.com/topic/96957-menu-system-with-mysql/#findComment-496268 Share on other sites More sharing options...
helbom Posted March 19, 2008 Share Posted March 19, 2008 ahh ok... first output the main menu.. then pull out the child id's that's linked to the main menu id then continue the looping trough everything Link to comment https://forums.phpfreaks.com/topic/96957-menu-system-with-mysql/#findComment-496273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.