[eluser]Stefan Hueg[/eluser]
It would return the first row. The thing about the structure is just about expectation - result.
If you know that you can and will never get more then one result, row() is your function. If you don't know the actual number of results, result() is your function.
You have to keep an eye on which functions you use. row_array() is slightly faster than row(). If you get 1000 results and just want the very first one, don't rely on the active record functions row() and result(). What CodeIgniter does in case of row() is just:
-query 1000 results
-while-loop, fetching all the 1000 results
-return the first entry
You have two options for optimization:
-Optimize your SQL query by adding limits
-Fetch the results by yourself, like this
Code:
$result = $this->db->get('mytable');
while($row = mysql_fetch_assoc($result->result_id))
{
...
}
//or for a single result just one call of
$row = mysql_fetch_assoc($result->result_id)