Welcome Guest, Not a member yet? Register   Sign In
Issue with returned data from a model and getting output
#2

[eluser]BravoAlpha[/eluser]
[quote author="awpti" date="1185972648"]Do I need to do some goofy loop action for a single returned entry?[/quote]
User Guide: Generating Query Results
[quote author="User Guide"]result()
This function returns the query result as an array of objects, or an empty array on failure.
...
row()
This function returns a single result row.[/quote]

FWIW, I've been using something like this for functions that should return a single row:
Code:
function select_single($discussion_id)
{
    $this->db->where('discussion_id', $discussion_id);
    $query = $this->db->get('discussions', 1);

    return ($query->num_rows() != 0) ? $query->row() : FALSE;
}


Messages In This Thread
Issue with returned data from a model and getting output - by El Forum - 08-01-2007, 02:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB