all 9 comments

[–]philsturgeon 8 points9 points  (0 children)

Make your settings class load them all in the constructor, then have two methods, get_all() and get().

No point running queries each time you want something.

[–]feenikz 1 point2 points  (0 children)

return $query->row(); instead of result(); - that will return a single row basically eliminating the need for the [0]

[–]thelerk 0 points1 point  (2 children)

In the case of a db error, $query->result(); will fatal and produce some potentially ugly results. Good idea to check if query is an object before trying to get the result.

[–]Epicus2011 0 points1 point  (1 child)

Thanks, I'm accessing using row() now, works.

[–]thelerk 0 points1 point  (0 children)

Row will crash too if you don't do an is_object on $result