I'm trying to program a php script for family tree but I have a question about something was hard to do for me.
Now I have a table at database called people which consists of
- id
- name
- parent
- is_first
I want to use foreach to show up the people which have 1 at is_first then foreach the people who has parent = id for the greatest parents , then loop the last foreach to get the parents children using parent column.
Any help, please :")
That is my test
$data['test'] = $this->Tree->getForloop($id,"people ORDER BY id","");
foreach($data['test']->result() as $row){
$data['test'.$row->id] = $this->Tree->getForloop($row->id,"people","parent"); // parent = $row->id at people
}
but works for just 2 steps