Hello Everyone I Want To Ask How To Make Output Using Json_Encode To An Text Here's My Code
Model
function count_topup($ID)
{
$this->db->select_sum("Jumlah");
$this->db->from('topup');
$this->db->where('id_user',$ID);
$query= $this->db->get();
return $query->result_array();
}
Controller
$data['Count'] = $this->user_model->count_topup($ID);
View
<?php echo json_encode($Count);?>
it will give output [{"Jumlah":"150000"}]
How To Make Only showing 150000? Thanks For The Help
There is no need of json_encode();
Controller:-
$data['Count'] = $this->user_model->count_topup($ID);
$this->load->view('Your_view', $data);
View:-
foreach ($Count as $c)
{
<?php echo $c['Jumlah'];?>
}
Note:- For regarding how Array data is passed from controller to view is