I tried using the php library in CodeIgniter is grocery crud , but I found the problem . when I try to add new code something like this ?
I tried the tutorial here -- >
http://www.grocerycrud.com/documentation/options_functions/set_model
and I found that almost similar case here
/topic/2335-error-set-modelmy-custom-model/
My Set Model ->
class custom_model extends grocery_CRUD_Model {
public function __construct()
{
parent::__construct();
}
public function get_list($where)
{
if($this->table_name === null)
return false;
$select = "{$this->table_name}.*";
$select .= ", tb_category.category_name";
$this->db->select($select, false);
$this->db->distinct('post_id');
$this->db->join('tb_terms','tb_terms.post_id =tb_post.post_id');
$this->db->join('tb_category','tb_terms.parent_1 =tb_category.category_id');
$this->db->where('tb_category.category_type',$where);
$this->db->order_by('tb_terms.post_id');
$results = $this->db->get($this->table_name)->result();
return $results;
}
}
And this my controller :
public function post(){
try
{
$crud = new grocery_CRUD();
$where='gallery';
$crud->set_model('custom_model');
$this->custom_model->get_list($where);
$crud->set_table('tb_post');
//Set List Collum
$crud->columns('post_title','post_status','post_date','parent1','post_author');
$crud->where('tb_category.category_type','post');
$crud->set_relation_n_n('parent1', 'tb_terms', 'tb_category', 'post_id', 'parent_1', 'category_name',NULL,array('category_type' => $where));
$data['titlesub'] ='Post & Page';
$output = $crud->render();
$this->_example_output($output,$data);
}catch(Exception $e)
{
redirect('owner/not_found', 'refresh');
}
}
but this retur ERROR LIKE THIS -->
PHP Error was encountered Severity: Warning Message: Missing argument 1 for custom_model::get_list(), called in D:\Server\fbi\application\libraries\Grocery_CRUD.php on line 1312 and defined Filename: models/custom_model.php Line Number: 8 A PHP Error was encountered Severity: Notice Message: Undefined variable: where Filename: models/custom_model.php Line Number: 21
How to send and $where from controller to my custom model ... how so that I can send $where variables into my custom model ?? relation Set a relation n-n | and set_model
Select from tb_post join tb_terms join tb_category where category_type ...... on LIST ... because in add end edit is normal and no problem
