Undefined property when trying to access column not mentioned in CodeIgniter query's SELECT clause
02:17 21 Dec 2016

My validations are working okay, but after that userid and password results empty in model fit_reg_model and it results into authentication failed.

model


public function log_valid($userid, $password)
{
    $this->db->select("regID, loginCode");
    $whereCondition = $array = array(
        'regID' => $userid,
        'loginCode' => $password
    );
    $this->db->where($whereCondition);
    $this->db->from('fit_1login');
    $query = $this->db->get();

    // checking result
    echo"
";
    print_r ($query->result()); exit;
    return $query->row()->countID;
    
    if ($query->num_rows()) {  
        echo"
";
        print_r($query->result());
        exit;
        return $query->row()->countID;
        //return TRUE;
    } else {
        return FALSE;
    }
}
php codeigniter select query-builder resultset