Welcome Guest, Not a member yet? Register   Sign In
little help with a 2 dimensional array
#1

[eluser]Ngulo[/eluser]
hey guys my code is :

Code:
$populateCategories = $this->model_glossary->populateCategories();

  foreach($populateCategories as $row){

            
            $populateSubCategories = $this->model_glossary->populateSubCategoriesByIdCategory($row->id);
            
            
            foreach($populateSubCategories as $sub){

            $sub_array[]= array(
                'subcategory'=>$sub->subcategory,
                'slug'=>$sub->slug
                    );
            
            
           }
             $cat_sub []= array(
                'category'=>$row->category,
                'slug'=>$row->slug,
                'subcategory'=>$sub_array
                    );
            
        }

i'm still having problems cause i would like a 2 dimensional array like this :
array(
category => category_name
slug => category_name
subcategory => array( 'subcategory' => subcategory_name,'slug'=>subcategory_slug)

);
both my model queries returns $query->result()

any suggestion guys? Sad




Theme © iAndrew 2016 - Forum software by © MyBB