Reputation: 353
I am trying the following code but keep getting the this error:
PHP Fatal error: Call to undefined method news_model::get_db_message()
in my application/core/My_Model.php
class MY_Model extends CI_Model {
public function __construct() {
parent::__construct();
}
public function get_db_meesage() {
echo "bla";
}
}
this is my news_model.php
class news_model extends MY_Model {
public function __construct()
{
parent::__construct();
}
public function delete_news($news_id) {
$this->get_db_message();
}
}
I felt it is probably a very subtle error but I just can't figure this out..
Upvotes: 0
Views: 443
Reputation: 7902
Correct answer taken from comments.
Codeigniter expects classes to start with a capital letter. This is stated in their General Style and Syntax document.
To quote:
Class and Method Naming
Class names should always start with an uppercase letter. Multiple words should be separated with an underscore, and not CamelCased. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names.
INCORRECT: class superclass , class SuperClass
CORRECT: class Super_class
Upvotes: 2
Reputation: 7895
public function get_db_meesage() {
echo "bla";
}
PHP Fatal error: Call to undefined method news_model::get_db_message()
get_db_message()
get_db_meesage()
Upvotes: 0