Postingan lainnya
Trying to get property of non-object pada codeigniter
Gan tolong stuck dengan message error
Severity: Notice
Message: Trying to get property 'kode_matakuliah' of non-object
Filename: administrator/nilai_daftar.php
Line Number: 9
Message: Trying to get property 'id_thn_akad' of non-object
Filename: administrator/nilai_daftar.php
Line Number: 10
view
<?php
$nilai = get_instance();
$nilai->load->model('krs_model');
$nilai->load->model('mahasiswa_model');
$nilai->load->model('matakuliah_model');
$nilai->load->model('tahunakademik_model');
$krs = $nilai->krs_model->get_by_id($id_krs[0]);
$kode_matakuliah = $krs->kode_matakuliah; //<- LINE 9
$id_thn_akad = $krs->id_thn_akad; //<- LINE 10
?>
<div class="container-fluid">
<div class="alert alert-success">
<i class="fas fa-university"></i> DAFTAR NILAI MAHASISWA
</div>
<center>
<legend><strong>DAFTAR NILAI MAHASISWA</strong></legend>
<table>
<tr>
<td>Kode Matakuliah</td>
<td>: <?php echo $kode_matakuliah; ?></td>
</tr>
</table>
</center>
</div>
controller
public function simpan_nilai()
{
$query = array();
$id_krs = $_POST['id_krs'];
$nilai = $_POST['nilai'];
for ($i = 0; $i < sizeof($id_krs); $i++) {
$this->db->set('nilai', $nilai[$i])->where('id_krs', $id_krs[$i])->update('krs');
}
$data = array(
'id_krs' => $id_krs
);
$this->load->view('templates_administrator/header');
$this->load->view('templates_administrator/sidebar');
$this->load->view('administrator/nilai_daftar', $data);
$this->load->view('templates_administrator/footer');
}
0
1 Jawaban:
<pre> $krs = $nilai->krs_model->get_by_id($id_krs[0]); </pre>
saat jalanin script ini, dia tidak menemukan krs dengan id, $id_krs[0]
saran saya untuk coba
<pre> var_dump($id_krs[0]); exit; </pre> apakah ada value nya variable tersebut?? kalau ada lanjut ke
<pre> var_dump($krs); exit; </pre> nanti kelihatan salah dimana, taruh kode tersebut sebelum line 9
0