[SOLVED] Producing a hierarchial listing from simple table - 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: [SOLVED] Producing a hierarchial listing from simple table (/showthread.php?tid=20580) |
[SOLVED] Producing a hierarchial listing from simple table - El Forum - 07-14-2009 [eluser]johnnytoobad[/eluser] I'm slowly learning CI and things as going well as a newbie. I've managed basic select, update, delete etc code. I'm working on a learning some code for a basic '"categories" system. I went back and found a snippet I always trusted when i worked in plain php: Code: $result = somedb_query("SELECT id, parent_id, name FROM mytable ORDER BY name"); I attempted to rewrite this in CI and got this far before my head started spinning: Code: $this->db->order_by("name", "asc"); I'm stuck on the part that runs the sortCategories function, I'm thinking maybe that I haven't quite grasped the whole MVC thing and that I shouldn't be putting all that code in the controller. Can someone point me in the right direction as to how to achieve this in CI. Many Thanks |