Maybe I have some misunderstanding in this part of the Array procedure/syntax...
What I'm wondering is why once I get the result from the db I HAVE to go thru a foreach or other kind of loop.
Let's say I know I'll only get ONE result from the query:
$query = $this->db->query("MY QUERY LIMIT 1");
Up to now I'll have to go thru it with a loop:
foreach ($query->result() as $row){
echo $row->title;
echo $row->name;
echo $row->body;
}
Is there a way to get the item printed without a loop (for, foreach or other)? Like:
$query->result()->title;
//OR
$query->result()[0]
Or something else?
The above method I tried of course are not working...
Perhaps is just a bad practice. Is it impossible? Doable? Or...?