[eluser]drseuss[/eluser]
Ok... title says it and I can't fix it.
Error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Account::$account_model
Filename: controllers/account.php
Line Number: 21 (This line is: $query = $this->account_model->login(); )
( ! ) Fatal error: Call to a member function login() on a non-object in C:\wamp\www\application\controllers\account.php on line 21
Call Stack
# Time Memory Function Location
1 0.0022 694208 {main}( ) ..\index.php:0
2 0.0076 765744 require_once( 'C:\wamp\www\system\core\CodeIgniter.php' ) ..\index.php:163
3 0.1329 4147912 call_user_func_array ( ) ..\CodeIgniter.php:297
4 0.1329 4147992 Account->login( ) ..\CodeIgniter.php:0
account.php (controller)
Code:
class Account extends CI_Controller {
function __construct()
{
parent::__construct();
}
function login() {
$this->load->model('account_model');
$query = $this->account_model->login();
//$accountId = $this->account_model->account_info('id');
if($query) {
$session_data = array(
'email'=>$this->input->post('email'),
'accountId'=>$accountId->id,
'is_logged_in'=>true
);
$this->session->set_userdata($session_data);
//redirect('character');
echo "oh yea!";
} else {
$data['error'] = "Bad login information supplied. <br />";
$this->load->view('home',$data);
}
}
}
account_model.php (model)
Code:
class Account_model extends CI_Model {
function __construct()
{
parent::__construct();
}
function login() {
$this->db->where('email',$this->input->post('email'));
$this->db->where('password',$this->input->post('password'));
$query = $this->db->get('accounts');
if($query->num_rows == 1) {
return true;
}
}
}
If anything else is needed just tell me