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

[eluser]xwero[/eluser]
A quick solution to use the fastest queries and the least data using AR
Code:
function get_profiles($fields)
{
    if(!empty($fields){ $this->db->select($fields); }

    return $this->db->get('table')->result();
}

function get_profile($id,$fields='')
{
   if(!empty($fields){ $this->db->select($fields); }

   return $this->db->get_where('table',array('id'=>$id))->row();
}
It's too bad the get and get_where method don't provide this option themselves because i think there are more queries where you need to get specific fields/columns than there are getting all the fields from a table.


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