Generating child categories

// For Generating Array Parent & Child Wise $this->dash_model->cattest(0)); public function cattest($parent_id) { $sqlquery = ” SELECT * FROM categories where parent='” .$parent_id . “‘ “; $row = $this->db->query($sqlquery)->result_array(); $allCategory = array(); if(count($row)>0){ foreach ($row as $value){ $tempCat    = array(); $cat_id     = $value[‘id’]; $tempCat[‘categoty_details’] = $value; //has sub category $hasSubCat = $this->cattest($cat_id); … Read moreGenerating child categories

Get all child category under a category

## get all childs & their childs under a parent category //get all childs & their childs public function get_child_categories( $parent_id ){ $childtree = $this->nowbuild_child_tree($parent_id); echo “<pre>”; print_r($childtree); echo “</pre>”; } //now build all child tree against parent id public function nowbuild_child_tree( $parent_id ) { $sqlquery = ” SELECT * FROM categories where parent='” .$parent_id … Read moreGet all child category under a category