newbie here. How can I get the total sum of the "amount" column? I tried working on a function but it's not dynamic. It only reads the column of my main account. But when i logged on another account, The total amount is still the same. My target is, how can i make it dynamic based on userID? Thank you in advance
Views:
<div class="small-box bg-success">
<div class="inner">
<h3><?php echo $tcash;?><sup style="font-size: 20px"> Php</sup></h3>
<p><b>Total Cash-In</b></p>
</div>
<div class="icon">
<i class="fas fa-coins"></i>
</div>
Controller:
public function cashout()
{
$data['activeNav'] = "";
$data['subnav'] = "ewallets";
$this->header($data);
$this->nav();
$data['tcash']=$this->load->ewallets->gettotalcashin();
$this->load->view('cashout', $data);
$this->footer();
}
Model:
function gettotalcashin(){
$this->db->select_sum('amount');
$result = $this->db->get('cash_out')->row();
return $result->amount;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…