A PHP Error was encountered in CodeIgniter -
help:
i have error:
a php error encountered
severity: warning
message: illegal string offset 'periode'
filename: models/k3m.php
line number: 32
a php error encountered
severity: warning
message: illegal string offset 'bulan'
filename: models/k3m.php
line number: 33
fatal error: call member function row() on non-object in c:\laporbos\htdocs\laporbos3\application\modules\laporan_k3\models\k3m.php on line 39
function saldo_bank($param) { $periode = $param['periode']; $bulan = $param['bulan']; $bulan = $this->get_bulan2($periode,$bulan); $sql="select ifnull( sum(ifnull(jumlah_debet,0) ),0) - ifnull( sum(ifnull(jumlah_kredit,0) ),0) saldo buku_bank year(tanggal) =".$this->session->userdata("tahun_anggaran")." , month(tanggal) < $bulan"; $data = $this->db->query($sql)->row(); return $data->saldo; }
this occurring because calling row() before have called result(), change this
$data = $this->db->query($sql)->row();
to this
$data = $this->db->query($sql)->result()->row();
Comments
Post a Comment