Hi all.
I am new for grocery crud.
I trying to join 2 table and display it. I wrote a custom model to extends crud model.
My custom model:
<?php
class Test_crud_model extends Grocery_crud_model {
protected $primary_key = 'film_id';
protected $table_name = 'film';
function __construct()
{
parent::__construct();
}
function get($id = null, $order_by = null){
if(is_numeric($id)){
$this->db->where($this->primary_key,$id);
}
if(is_array($id)){
foreach($id as $key => $_value){
$this->db->where($key,$_value);
}
}
$q =$this->db->get($this->table_name);
return $q->result_array();
}
}
?>
My controller:
function test_example(){
$crud = new grocery_CRUD();
$crud->set_model('Test_crud_model');
$crud->set_table('film');
$crud->result = $this->Test_crud_model->joinTable(array(
'film_actor.film_id'=> 23
));
$output = $crud->render();
$this->testView($output);
}
My output are display all data from "film" table.
