⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Pretty stupid problem ... where method is not working



James
  • profile picture
  • Member

Posted 11 July 2019 - 18:34 PM

Hi

 

It's a very first post here, so welcome guys.

I'm just writting a simple webapp for my client and I looks like GC delivers almost all functionality what I need.

 

But there is one problem. I'm just messing around documentation and API and I'm trying to get values with where method.

But ... at the end nothing is changed :/

public function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->helper('url');
        /* ------------------ */

        $this->load->library('grocery_CRUD');
    }

    public function index()
	{
		$this->load->view('welcome_message');
	}

	public function employees(){
	    $crud = new grocery_CRUD();
	    $crud->where('jobTitle','Sales Rep')
	    $crud->set_table('employees');
	    $output = $this->grocery_crud->render();
        $this->example_output($output);
    }



    private function example_output($output = null){
	    $this->load->view('databaseView',$output);
    }
}

As you see I just added one line to a code what you can see in examples.

The question is: where is a problem ? ;P Of course I searched google for solution but I found nothing :(


genya
  • profile picture
  • Member

Posted 22 July 2019 - 19:12 PM

Including the table name solved the problem for my cases, so in your case the code would be

$crud->where('employees.jobTitle','Sales Rep');

instead of

$crud->where('jobTitle','Sales Rep')