Hello,
i have a problem. i do through a tutorial of the book “professional codeigniter” and i get this errors:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Welcome::$db
Filename: core/Model.php
Line Number: 51
Fatal error: Call to a member function get() on a non-object in E:\xampp\htdocs\CI_2.1.3\application\models\mcats.php on line 39
Thats my Code:
application/models/mcats.php:
function getAllCategories() {
$data = array();
$Q = $this->db->get('categories'); //line 39
if($Q->num_rows() > 0) {
foreach($Q->result_array() as $row) {
$data[] = $row;
}
}
$Q->free_result();
return $data;
Model.php:
function __get($key)
{
$CI =& get_instance();
return $CI->$key; //Thats Line 51
}
I use the CodeIgniter Version 2.1.3.. Help please ![]()
