Jump to content

ci from indonesia

Member Since 16 Oct 2014
Offline Last Active Nov 08 2014 03:02 AM

Topics I've Started

grocery crud set model with parameters, Declare parameters extends class

17 October 2014 - 03:48 AM

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 -- >


and I found that almost similar case here


My Set Model ->

class custom_model extends grocery_CRUD_Model  {
public function __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->join('tb_terms','tb_terms.post_id =tb_post.post_id');
    $this->db->join('tb_category','tb_terms.parent_1 =tb_category.category_id');

    $results = $this->db->get($this->table_name)->result();

    return $results;

And this my controller :

public function post(){
            $crud = new grocery_CRUD();


            //Set List Collum

            $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();
        }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