Set a relation n-n
function film_management() { $crud = new grocery_CRUD(); $crud->set_table('film'); $crud->set_relation_n_n('actors', 'film_actor', 'actor', 'film_id', 'actor_id', 'fullname','priority'); $crud->set_relation_n_n('category', 'film_category', 'category', 'film_id', 'category_id', 'name'); $crud->unset_columns('description','special_features','last_update'); $crud->fields('title', 'description', 'actors' , 'category' ,'release_year', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features'); $output = $crud->render(); $this->_example_output($output); }
Note: The below example is an iframe so it might appeared with a scroll bar. If you like you can view the example
on a new tab
You can view the field names to the documentation by clicking on Relation n-n function