This is my first time doing web programming. I want to make one variable that I can use on some functions, I use `public $username;` and `public $password;` and use `$this->username` and `$this->password;` but it didn't work. This is my code on controller;

```
public $can_log ;

public function home(){

    $this->load->model("model_get");

    $data["results"] = $can_log;

    $this->load->view("content_home",$data);
}

public function login(){
    $this->load->view("site_header");
    $this->load->view("content_login");
    $this->load->view("site_footer");
}

public function login_validation(){
    $this->load->library('form_validation');
    $this->load->view("site_header");
    $this->load->view("site_nav");

    $this->form_validation->set_rules('username','Username','required|trim|callback_validate_credentials');
    $this->form_validation->set_rules('password','Password','required|trim');// use md5 if want to encrpyt this

    if($this->form_validation->run()){
        redirect('site/home');
    } else {
        $this->load->view('content_login'); 
    }
}

public function validate_credentials(){
    $this->load->model('model_get');

    $username = $this->input->post('username');//"user";
    $password = $this->input->post('password');//"password";
    //I tried both but none of those work

    $this->can_log = $this->model_get->can_log_in($username, $password);

    if($this->can_log){
        return true;
    } else {
        $this->form_validation->set_message('validate_credentials','Incorrect username/password.');
        return false;
    }
}

```

I also tried with `public $username` and `public $password` but still can't get it

on my model;

```
public function can_log_in($username, $password){
    $query = $this->db->query("SELECT col1, col2 FROM table1 where id_login = '$username' and id_password = '$password'");

    if($query->num_rows() > 0) {
        $data = $query->result(); // fetches single row: $query->row();
        return $data; //fetches single column: $data->col1;
    }
}

```

so how can I get can\_log - that contains col1 and col2 - to other function?