I needed to collect all the rows for the result. Using select_sum as follows
Here is a model
function Dues_Paid_Tot($date)
{
$query = $this->db->select_sum('Dues_Paid', 'Dues_Paid_Tot');
$query = $this->db->get('Membership');
return $query->result();
}
Here is the controller
function Fiscal2()
{
$date = $this->input->post('Select_Date');
if($query = $this->report_model->fiscal_list($date))
{
$data['records'] = $query;
}
$data['date'] = $this->input->post('Select_Date');
$data['Dues_Paid_Tot'] = $this->report_model->Dues_Paid_Tot($date);
$data['main_content'] = 'report_fiscal_view';
$this->load->view('includes/template', $data);
}
And this is the appropriate code to represent
<?php echo $Dues_Paid_Tot; ?>
The problem is that instead of summing all the entries in the Dues_Paid column, I get an "Array" in my opinion.
Where am I going wrong?
Thank!
source
share