[solved] Making a parentlist of id |
I have a forum table.
I need to make a parent list of all my pids. Lets say if I need to make parentlist for fid 36 As shown in image below Then then it should return PID numbers only 35, 34, 1 not to return 0 if pid is 0 ![]() Example I have tried PHP Code: public function make_parent_list() { Question How can I get it to properly make the parentlist. Can not seem to return 35, 34, 1 if fid 36
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Revisiting the multilevel menu in PHP with some additional code
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(12-05-2016, 04:01 AM)InsiteFX Wrote: Revisiting the multilevel menu in PHP with some additional code Don't think is what I am after to not need to create a menu.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
Try making a recursive function.
Maybe this will work: PHP Code: private function get_parents($fid, &$parents = array())
I now have tried this
PHP Code: public function make_parent_list($fid) { But the implode throws error here Code: A PHP Error was encountered Echo out put is 34,Array PHP Code: $results = $this->make_parent_list('36');
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
(12-05-2016, 08:53 PM)wolfgang1983 Wrote: I now have tried this PHP Code: string implode ( string $glue , array $pieces ) 1. $result is a int or an array 2. you forgot to escape $fid 3. http://stackoverflow.com/questions/29384...cture-list
Solution found
PHP Code: function getCategoriesByParentId($fid) { And PHP Code: $all_categories = $this->getCategoriesByParentId(36);
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |