Welcome Guest, Not a member yet? Register   Sign In
Passing too much information?
#3

[eluser]Dam1an[/eluser]
In all the get functions in my models, I have an optional select parameter which defaults to everything
Code:
// The function
function get_users($select = '*') {
    $this->db->select($select);
    $query = $this->db->get('users');
    
    return $query->num_rows() == 0 ? false : $query->result();
}

// Getting all the fields
$users = $this->user_model->get_users();

// get just their name and surname
$users = $this->user_model->get_users('first_name, last_name');


Messages In This Thread
Passing too much information? - by El Forum - 05-21-2009, 07:21 PM
Passing too much information? - by El Forum - 05-22-2009, 01:39 AM
Passing too much information? - by El Forum - 05-22-2009, 01:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB