[eluser]philstan[/eluser]
I know this is a laughably newbie question, but I just can't find an answer and would love some help.
I have this SQL statement in my model and obviously I'm looking to return a single value and not an array. How do I do it please as this is still returning an array?
Code:
function get_dollars_by_month ($month, $donator_co)
{
$query = $this->db->query("SELECT SUM( dollars )
FROM fh_financial_donations
WHERE MONTH( date ) = MONTH( DATE_SUB( CURDATE( ) , INTERVAL ".$month."
MONTH ) ) AND donator_co = ".$donator_co."");
if ($query->num_rows() == 1) {
return $query->row();
} else {
return FALSE;
}
}
Which returns:
Code:
stdClass Object ( [SUM( dollars )] => 398 )
Would love to NOT have to access an array. However, I'm not sure how to access this array anyway...
Thanks, philstan