$this->load->model() not working in CodeIgniter
The name needs to be the same in all places:
Here:
class Math_model extends CI_Model { // your model}
Here:
$this->load->model("math_model");
When using it:
$this->math_model->add();
And: in your file system. So rename math.php
to math_model.php
and it will work.
The name of the file should be math_model.php and you should call it like this:
echo $this->math_model->add();
The question has been answered really and the problem was this:
<?php class Math_model extends CI_Model(){ //so on } ?>
..it's the open and close parethesis after declaring the class..it should be:
<?php class Math_model extends CI_Model{ //so on } ?>
thank you so much for those who responded