Codeigniter - select by id and print only the values of this id

0

Well, I'm trying to make a page that shows the user's data that is logged in. So I have to make a select to the id of the user in question. Controller:

function perfil()
{
    $this->load->model('perfil_model');
    $data['list'] = $this->perfil_model->getAllDisplayable3();
    $data['username'] = $this->session->userdata('username');
    $this->load->view('perfil_view',$data);
}   

Model:

function getAllDisplayable3()
 {
     //echo $username; echo die();
     $this->db->select('id_login, nome, username, password, cod_postal, telefone, email, localidade, rua');
     $this->db->from('login');
     //$this->db->where('username', $username);
 }

I tried to do what is commented out, but says that it does not know the $ username variable. That's supposed to be my session variable. In the view I have a form in which I want to print the user data. This is one of the inputs of the view:

<input class="form-control" id="nome" value="<?php echo $perfil->nome?>" type="text">

Thank you.

    
asked by anonymous 07.06.2016 / 12:00

0 answers