I have a method that should return a single value. Since it ->result()returns an array, I use the following to return the single value that I would like to get:
return array_pop($this->db->query($SQL)->result())->event_name;
while it works fine, I'm wondering if there is something built into CI that maybe I skipped in the documentation. I also use this trick to return a single entry:
return array_pop($this->db->query($SQL)->result());
Is there a better way to do this?
source
share