[eluser]Unknown[/eluser]
Hi, I keep getting the following error
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Auth::$DB
Filename: models/auth.php
Line Number: 8
Fatal error: Call to a member function get_where() on a non-object in /home/simon/public_html/web/astronomy/system/application/models/auth.php on line 8
I have read several posts and all seem to point to not loading the database library.
I have however got the following line in my autoload.php file
Code:
$autoload['libraries'] = array('database');
The following is the content of my database.php file
Code:
$active_group = "default";
$active_record = TRUE;
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "simon_simon";
$db['default']['password'] = "***********";
$db['default']['database'] = "simon_SiteDB";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
I have loaded the model in my controller with
Below is the code from my model, which is generating the undefined property error
Code:
<?php
class Auth extends Model{
function DoLogin($Email,$Password){
$query = $this->db->get_where('user',array('email=>'&$Email & ',password=>'&$Password));
if ($query->result){
return true;
}
else
{
return false;
}
}
function Register($UserDetails){
}
}
The reason I think the database.php file is not being loaded is that I have deliberately added errors to the database.php file and do not get any error message.
Can someone help in where I may be going wrong. I have been pulling my hair out for about 5 hours.
Thanks
Simon