[eluser]panos konstantinides[/eluser]
Hello all, I have a model called Accounts, in a file called Accounts.php
Code:
<?php
class Accounts extends Model
{
function Accounts()
{
parent::Model();
}
function getAccount($username, $password, $account)
{
//TODO: Must fix query
$this->CI =& get_instance();
$this->CI->db->from('accounts');
$this->CI->db->where('username',$username);
$this->CI->db->where('password',$password);
$this->CI->db->where('account_name', $account);
return $this->CI->db->get();
}
}
I have declared my model to be autloaded from within the autoload.php
Code:
$autoload['model'] = array('Accounts');
but when I try to access the method by doing
Code:
$query = $this->Accounts->getAccount($username, $password, $account);
I get the following error message
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: Authentication::$Accounts
Filename: libraries/Authentication.php
Line Number: 15
Fatal error: Call to a member function getAccount() on a non-object in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\CodeIgniter_1.7.1\system\application\libraries\Authentication.php on line 15
Any ideas what's going on? I have played around with lower case and upper case letters but to no avail. The only thing I can think of is that the use of "db" from within the model is causing problems, since the database controller is also automatically loaded from the autoload.php. I tried to move the autoload of the model further up (before the line that loads the controllers) but still no luck. Any ideas?
Regards
Panos