[eluser]linusan[/eluser]
Hi, I'm getting more and more frustrated while trying to fix and understand the error I'm getting (since yesterday). I even don't understand why there is a problem at all. The controller looks exactly like all my other controllers (which work perfectly) and I can't find any typo in this one as well. I really hope someone can prevent me from getting insane...
Here is the whole error:
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: Search::$load
Filename: controllers/search.php
Line Number: 11
Fatal error: Call to a member function library() on a non-object in /htdocs/findjou/application/controllers/search.php on line 11
So, on a page there is a (search)form, which links to the controller search and the function search within.
Code:
echo form_open('search/search');
...
The Controller search.php:
Code:
<?php
class Search extends CI_Controller {
/*function __construct(){
parent::__construct();
}*/
function search(){
$this->load->library('form_validation');
$this->form_validation->set_rules('keyword', 'Keyword', 'trim|min_length[4]');
if($this->form_validation->run() == FALSE) {
redirect('talents/show');
} else {
$this->load->model('search_model');
$data['result'] =$this->search_model->search();
$data['main_content'] = 'search';
$this->load->view('includes/login_template', $data);
}
}
}
The database is auto loaded from the config. The error occurs as well when I try to comment the library-load or the model-load.
I really don't understand why this error only occurs with this controller/function. My other controllers and functions look exactly the same and work perfectly. Even those which manage the login functions and other things, which as well are called by a form. I can't notice any difference.
PS: While trying to debug this error I found a piece of code which was meant to solve the error (which failed), but what exactly does this do?
Code:
*function __construct(){
parent::__construct();
}
Thank you so much!