$this->db->select('name');
$this->db->from('tblNAME');
$this->db->where('res_id', $res_id);
return $this->db->get()->result();
It is faster and more efficient, I suppose, because you are not returning everything.
UNTESTED
Here is a proven function that I use so you can find a good re sign
function get($id = null)
{
$this->db->select('id, Username, First_Name, Last_Name, Role, Email');
$this->db->from('user');
if (!is_null($id)) $this->db->where('id', $id);
$this->db->order_by('id', 'desc');
return $this->db->get()->result();
}
source
share