I am pulling data from a MySQL database. I want to print out all individual rows, then total them. My use of arrays and sum of those arrays has me baffled. I want to print out one total value that sums all data from field "total". This is in joomla
function totalsales($total)
{
$db =& JFactory::getDBO();
$query = "SELECT total,contact_id FROM #__invoices WHERE contact_id='$total' ";
$db->setQuery($query);
$sum = $db->loadObjectlist();
print_r (array_values($sum));
}
$total3 = (contactsearch($this->row->id));
I think i have to go through a loop, but i'm stuck 😕