[eluser]Önder ÖZCAN[/eluser]
My Model is
Code:
class Content_list extends CI_Model
{
function __construct()
{
// Call the Model constructor
parent::__construct();
}
public function getContents()
{
$data['query'] = $this->db
->select('cat.catName')
->select('cat.cat_ID')
->select('cat.language')
->select('con.category_ID')
->select('con.content_ID')
->select('con.content_ID')
->select('con.lastUpdated')
->from('content con')
->from('category cat')
->where('con.category_ID' , 'cat.cat_ID')
->where('userPassword' , $password)
->where('userEnabled' , 'true')
->get();
if($data['query']->num_rows() == 0) {
$this->session->set_flashdata('message', 'Sistemde ekli bir içerik bulunmamıştır.');
redirect('login');
return;
}
}
}
And my controller looking like that
Code:
class admin extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('content_list');
$this->publicData = array();
$this->publicData['username'] = $this->session->userdata('username');
$this->Content_list->getContents();
$this->publicData['query'] = $this ->Content_list->data['query'];
}
public function index()
{
$this->load->view('admin/index', $this->publicData);
}
}
The output gives error like that :
Severity: Notice
Message: Undefined property: admin::$Content_list
Filename: controllers/admin.php
Line Number: 15
Fatal error: Call to a member function getContents() on a non-object in /Applications/MAMP/htdocs/mediaworks/application/controllers/admin.php on line 15
My all database, session and other libraries and helper had added on autoload config. The problem is , CI cannot find the proper object in model even if i call the model correct.
Can anyone tell me where was i wrong ?