A
A
arcticnomads2015-10-29 14:54:16
CodeIgniter
arcticnomads, 2015-10-29 14:54:16

Codeigniter how to display the result of select_sum in a view?

Controller

public function test() {

    $data['balance'] = $this->dash_model->get_test();
        	$this->load->view('dash/current_balance', $data);
  }

model
public function get_test() {

    $this->db->select_sum('amount');
        	$query = $this->db->get('operations');
        	/*$res = $query->result_array();*/
    return $query->assoc();
        	/*print_r($res);*/
  }

If you uncomment two lines, index.php/dahs/test will display correctly print_r
got confused, I can’t figure out how to display this amount in the view now, for example, on the page view/dash/current_balance.php
Thanks for the help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
krypt3r, 2015-10-29
@krypt3r

There is a magic function var_dump()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question