Welcome Guest, Not a member yet? Register   Sign In
...undefined property
#1

[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


Messages In This Thread
...undefined property - by El Forum - 03-29-2011, 02:15 PM
...undefined property - by El Forum - 03-29-2011, 02:23 PM
...undefined property - by El Forum - 03-29-2011, 02:26 PM
...undefined property - by El Forum - 03-29-2011, 02:33 PM
...undefined property - by El Forum - 03-29-2011, 02:54 PM
...undefined property - by El Forum - 03-29-2011, 03:09 PM
...undefined property - by El Forum - 03-29-2011, 03:29 PM
...undefined property - by El Forum - 03-29-2011, 04:33 PM
...undefined property - by El Forum - 03-29-2011, 04:35 PM
...undefined property - by El Forum - 03-29-2011, 08:00 PM
...undefined property - by El Forum - 03-29-2011, 10:16 PM
...undefined property - by El Forum - 03-30-2011, 07:11 AM
...undefined property - by El Forum - 03-30-2011, 07:42 AM
...undefined property - by El Forum - 03-30-2011, 08:02 AM
...undefined property - by El Forum - 03-30-2011, 08:09 AM
...undefined property - by El Forum - 03-30-2011, 08:20 AM
...undefined property - by El Forum - 03-30-2011, 08:23 AM
...undefined property - by El Forum - 03-30-2011, 08:29 AM
...undefined property - by El Forum - 03-30-2011, 09:47 AM
...undefined property - by El Forum - 03-30-2011, 10:17 AM
...undefined property - by El Forum - 03-30-2011, 10:19 AM
...undefined property - by El Forum - 03-30-2011, 10:20 AM
...undefined property - by El Forum - 03-30-2011, 10:31 AM
...undefined property - by El Forum - 03-30-2011, 10:41 AM
...undefined property - by El Forum - 03-30-2011, 10:53 AM
...undefined property - by El Forum - 03-30-2011, 10:58 AM
...undefined property - by El Forum - 03-30-2011, 11:14 AM
...undefined property - by El Forum - 03-30-2011, 11:24 AM
...undefined property - by El Forum - 03-30-2011, 11:35 AM
...undefined property - by El Forum - 03-30-2011, 12:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB