[eluser]BobbyB[/eluser]
Thanks to both of you!
The following line throws the error:
Code:
$this->model->add($cat);
I tried to implement your solutions but did not manage to get it working.
I also tried passing the variable like this:
Code:
//Controller:
$this->load->model('Get_freebies');
$data = array(
'category' => $this->input->get_post('category', TRUE)
);
$data['freebies'] = $this->Get_freebies->getselect($data);
But this gives me "Undefined variable: data" error in the model.
Mmmhhh?
Can't be that hard to just pass some data to the model can it?
UPDATE:
Got it working now:
Code:
//Controller:
$category = $this->input->get_post('category', TRUE);
$this->load->model('Get_freebies');
$data['freebies'] = $this->Get_freebies->getselect($category);
//Model:
function getselect($category)//I forgot to add "$category to the function
{
...
$this->db->where('category',$category);
...
}