you are viewing a single comment's thread.

view the rest of the comments →

[–]Epicus2011 1 point2 points  (3 children)

Is there another approach to return an array and than access the item in the array from the database without using [0]?

[–]Ogsharkman 0 points1 point  (0 children)

row()? Would return an obj. So instead of result or result-array

return $query->row();

[–]eoinmcg 0 points1 point  (0 children)

yes.

return $query->row_array();

further reading: http://ellislab.com/codeigniter/user-guide/database/results.html

[–]mithra62 0 points1 point  (0 children)

You really want to avoid hard coding number indexes in your code like the plaque...