Postingan lainnya
Trying to get property of non-object di codeigniter
Tolong bantuannya temen", bener" mentok ini hmm Pesan : Message: Trying to get property of non-object
Filename: controllers/web.php
Line Number: 641
Controller
$data['web'] = $this->m_web->getDatasaldo($this->session->userdata("id_user"))->result();
$saldo = $this->m_web->cariSaldoCustomer($this->session->userdata('id_user'));
$data['saldo'] = $saldo->saldo; // line 641
$this->template->display('web/topup', $data);
Model
function cariSaldoCustomer($nama)
{
$this->db->distinct();
$this->db->select("*");
$this->db->from("kartu");
$this->db->join("user","user.id_user=kartu.id_user");
$this->db->where("user.id_user",$nama);
return $this->db->get()->row();
}
function getDatasaldo($id){
$query=$this->db->query("select * from saldo_topup where id_user = '$id' order by tgl_topup desc");
return $query;
}
0
1 Jawaban:
coba ubah function ini:
function cariSaldoCustomer($nama)
{
$this->db->distinct();
$this->db->select("*");
$this->db->from("kartu");
$this->db->join("user","user.id_user=kartu.id_user");
$this->db->where("user.id_user",$nama);
//return $this->db->get()->row(); //ubah ini
return $this->db->get()->result_array(); // jadi ini
}
0