query problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: query problem (/showthread.php?tid=60273) |
query problem - El Forum - 02-20-2014 [eluser]Bigil Michael[/eluser] I would like to create a menu like this from a single table Code: two wheeler Code: I have created table with name menus, like this i wrote the query like this Code: SELECT p.menu_name as menu,d.menu_name as sub_menu,f.menu_name as sub_sub_menu FROM menus AS p join menus d on d.parent = p.id join menus f on f.parent = d.id and tried to print the result in a normal way Code: <?php Code: four weeler can anyone help me to solve this issue.... query problem - El Forum - 02-20-2014 [eluser]bgreene[/eluser] left join query problem - El Forum - 02-20-2014 [eluser]noideawhattotypehere[/eluser] why dont you just pull everything from the table and make it as an list in php? all these non breaking spaces look ugly. i event posted a function for this not so long time ago. query problem - El Forum - 02-21-2014 [eluser]jonez[/eluser] Why use a single table? Multiple tables with foreign keys are more flexible and you can cascade deletes, ensure referential integrity, etc. query problem - El Forum - 02-21-2014 [eluser]Bigil Michael[/eluser] thanks query problem - El Forum - 02-25-2014 [eluser]Bigil Michael[/eluser] i have solved up to 2 level like this. controller Code: $build_array = array(); model Code: function get_parent_menu(){ Code: <?php foreach($all_menu as $mn){?> from this code i can print main menu and sub menu. but i have to print sub of sub menu also. can any one help me to modify this code. query problem - El Forum - 02-26-2014 [eluser]Bigil Michael[/eluser] can any one solve this issue. query problem - El Forum - 02-27-2014 [eluser]jonez[/eluser] Make your controller logic a function and call it recursively. |