I'm having a difficulty getting the sum of the array.
Since I have a different formula, I can't use the codeigniter's function select_sum()
The code below is my attempt, but I have failed to make it functional.
$this->db->where('request_id', $this->input->post('request_id'));
$this->db->join('medical_request_items', 'items.item_id=medical_request_items.item_id');
$quer2 = $this->db->get('items');
foreach ($quer2->result() as $row) {
$lol = (($row->item_quantity * $row->item_retailprice) - ($row->item_quantity * $row->discount) - ($row->item_quantity * $row->philhealth) - ($row->item_quantity * $row->senior));
}
echo array_sum(array($lol));
$lolis not even an array. I'm pretty surearray_sumwon't work.array_sum(array($lol))