Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getGroups()
- {
- $result = $this->db->select('*')->from('tabulka')->execute();
- $pairs = $result->fetchPairs('id|name');
- $groups = array();
- foreach ($result->fetchAssoc('parent[]=id') as $parent => $ids) {
- foreach ($ids as $id) {
- $groups[$pairs[$parent]][$id] = $pairs[$id];
- }
- }
- return $groups;
- }
Advertisement
Add Comment
Please, Sign In to add comment