⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. Very soon this forum will be read-only and archived. ⚠

grocery crud set model with parameters, Declare parameters extends class

set_model set_relation_n_n where_RELATION

  • Please log in to reply
No replies to this topic

#1 ci from indonesia

ci from indonesia


  • Members
  • Pip
  • 1 posts

Posted 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




Attached Thumbnails

  • print.gif

Also tagged with one or more of these keywords: set_model, set_relation_n_n, where_RELATION

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users