Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to undefined method
#4

[eluser]Perkin5[/eluser]
The full error line is:

Fatal error: Call to undefined method Admin_model::get_code() in C:\wamp\www\historystoreNew\application\controllers\admin2012.php on line 119

line 119 is the third line of fetchcode ie where the call to the model method occurs.

I've simplified get_code in the model to this:

Code:
function get_code($pricecat){
print_r('got this far');die();
}


The controller method fetchcode is:

Code:
function fetchcode(){
$pricecat = 'price_cat';
$results = $this->Admin_model->get_code($pricecat);
return $results;
}

price_cat is the name of the db table I'm trying to access.

The model is admin_model.php and I loaded it in the controller constructor like this:

Code:
$this->load->model('Admin_model');

and I know that's OK because other controller methods are accessing other model methods perfectly satisfactorily. I almost convinced myself that get_code was a reserved word in codeigniter but it isn't.


Another thing I've tried is to copy the get_code method into the controller and access from there - modifying fetchcode obviously - in which case it works fine

The syntax of fetchcode is identical to other successful methods - I can't understand what's going wrong.



Messages In This Thread
Fatal error: Call to undefined method - by El Forum - 03-20-2012, 06:19 AM
Fatal error: Call to undefined method - by El Forum - 03-20-2012, 06:25 AM
Fatal error: Call to undefined method - by El Forum - 03-20-2012, 07:34 AM
Fatal error: Call to undefined method - by El Forum - 03-21-2012, 06:05 AM
Fatal error: Call to undefined method - by El Forum - 03-21-2012, 06:24 AM
Fatal error: Call to undefined method - by El Forum - 03-21-2012, 06:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB