Question: I am having this problem where my code is returning only one value. 

```
class Userlogin extends CI_Model {

    function login($username,$password) {
       $this -> db -> select('userid', 'username', 'password');
       $this -> db -> from('user');
       $this -> db -> where('username', $username);
       $this -> db -> where('password', $password);
       $this -> db -> limit(1);

       $query = $this -> db -> get();
         if($query -> num_rows() == 1)
           {             
             return $query->result();            
           }
           else
           {
             return false;
           }
    }

}

```

Here is the code that is using the particular model 

```
 if($result)
{     
     $sess_array = array();

     foreach($result as $row)
     {     
       $sess_array = array(
         'userid' => $row->userid,
         'username' => $row->username
       );       
       $this->session->set_userdata('logged_in', $sess_array);
     }

```

The problem is that it is returning only the userid but not the respective username for that id.

Answer: 
In your code, you've got the following line:

```
$this -> db -> select('userid', 'username', 'password');

```

You cannot pass multiple arguments to the `select` method of the db layer of Codeigniter. It has to be comma-seperated, like this:

```
$this -> db -> select('userid, username, password');

```

Hope this helped you out!

Reference: <http://ellislab.com/codeigniter/user-guide/database/active_record.html#select>
`select` method expects a string containing all the columns you want. Try 

```
$this -> db -> select('userid, username, password');

```