Recursive funciton in Codeigniter - 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: Recursive funciton in Codeigniter (/showthread.php?tid=54514) |
Recursive funciton in Codeigniter - El Forum - 09-12-2012 [eluser]foysal[/eluser] I have table named 'users', where columns are like user_id, parent_user_id etc. That means every user has a parent user. I would like to view user like below user1(parent user of user2) -user2(parent user of user3) --user3(parent user of user4) ---user4 user5(parent user of user) -user6 I am trying to do this using the following function of a model with recursive function. Code: public function user_list($user_id) Could any one help me in this regard ?? Thanks Foysal Recursive funciton in Codeigniter - El Forum - 09-12-2012 [eluser]WanWizard[/eluser] You're trying to implement an adjecency list. Google that and you get tons of solutions. Recursive funciton in Codeigniter - El Forum - 09-12-2012 [eluser]foysal[/eluser] I searched a lot in Google "adjacency list using codeigniter" but could not get any solution . I am trying now with following function of model. Code: public function user_list($user_id) Recursive funciton in Codeigniter - El Forum - 09-13-2012 [eluser]yacman[/eluser] Here you go! Code: function userTree($parent_id=0) { |