⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

n_n _relation



goutambose

goutambose
  • profile picture
  • Member

Posted 15 August 2016 - 04:01 AM

I added 3 table.

 

company,category,scategory

 

category:category_id,name

scategory:scat_id,sname,category_id

company:company_id,scat_id,cname,cweb,ccity,caddress

 

I use following code between company and scategory.

Now I want to relate data from category also.

 

How I will do it.I don't understand the example of n_n_relation

 

 
function addresses_management()
{
            $this->load->library('grocery_CRUD');
            




            $crud = new grocery_CRUD();




            $crud->set_theme('datatables');
            $crud->set_table('company');
            $crud->set_relation('scat_id','scategory','sname');
            
            $crud->columns('scat_id','cname','cweb','phone','ccity','ccountry','name');
            $crud->display_as('scat_id','Category Name');
            $crud->display_as('cname','Company Name');
            $crud->display_as('cweb','Website');
            $crud->set_subject('Company');
         
            $output = $crud->render();


            $this->_example_output($output);




}
 
how I make n_n_relation