I am trying to get the total number from the database. Here is the current setup.
I have many records with a column named total_cost (decimal field) and I wrote a select statement to select all total_cost and put it in an array named $total_cost.
Now I am trying to add all the cost together to get the sum and I try it with this.
foreach ($total_cost as $cost) :
$cost = $cost + $cost['total_cost'];
endforeach;
echo $cost;
That didn't work...
Any idea why?