Welcome Guest, Not a member yet? Register   Sign In
A PHP Error was encountered Severity: Notice Message: Undefined property: stdClass::$tanggal
#1

[eluser]aprij4nto13[/eluser]
Hi, I’m new to codeigniter and PHP for that matter.
i try using firebird database and i have troubled to show
data in view grid like this


A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$tanggal
Filename: controllers/absen.php
Line Number: 90

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$tanggal
Filename: controllers/absen.php
Line Number: 92

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$nis
Filename: controllers/absen.php
Line Number: 96

this part of absen.php in directory controller that line number show error

86 foreach ($absens as $absen)
87 {
88 // Konversi hari dan tanggal ke dalam format Indonesia
89 $hari_array = array('Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', Jumat', 'Sabtu');
90 $hr = date('w', strtotime($absen->tanggal)); /*this line number 90 */
91 $hari = $hari_array[$hr];
92 $tgl = date('d-m-Y', strtotime($absen->tanggal));
93 $hr_tgl = "$hari, $tgl";
94
95 // Penyusunan data baris per baris, perhatikan pembuatan link untuk updat dan delete
96 $this->table->add_row(++$i, $hr_tgl, $absen->nis, $absen->nama, $absen->kelas, $absen->absen,
97 anchor('absen/update/'.$absen->id_absen,'update',array('class' => 'update')).' '.
98 anchor('absen/delete/'.$absen->id_absen,'hapus',array('class'=> 'delete','onclick'=>"return confirm('Anda yakin akan menghapus data ini?')"))
99 );
100 }
101 $data['table'] = $this->table->generate();
102}


anyone can help ?

Regards
aprij4nto13
#2

[eluser]Seb[/eluser]
Well the thing is we need to know how you generate the $absens array.
#3

[eluser]aprij4nto13[/eluser]
THIS THE FULL CODE
#4

[eluser]Seb[/eluser]
Thank you.
The $absens array is generated in

Code:
$absens = $this->Absen_model->get_last_ten_absen($this->limit, $offset)->result();

But the model is not included in the zip file.

However, I think you will find the error with some debugging:

Code:
print_r($absens);

just after the previous line.

I guess you have some problem in the SQL query.
#5

[eluser]aprij4nto13[/eluser]
the model view in absen_model.zip on attachment

a part of this (get_last_ten_absen) function is like this

[/code]
function get_last_ten_absen($limit, $offset)
{

$this->db->select('absen.id_absen, absen.tanggal, absen.nis, siswa.nama, kelas.kelas, absen.absen');
$this->db->from('absen, siswa, kelas, semester');
$this->db->where('siswa.id_kelas = kelas.id_kelas');
$this->db->where('absen.nis = siswa.nis');
$this->db->where('semester.id_semester = absen.id_semester');
$this->db->order_by('absen.tanggal', 'desc');
$this->db->limit($limit, $offset);
return $this->db->get();
}
Code:
that any mistake with this query

I try to simplify the query code like this code
function get_last_ten_absen($limit, $offset)
{

$this->db->select('absen.id_absen, absen.tanggal, absen.nis, absen.nama, absen.id_kelas, absen.absen');
$this->db->from('absen');
$this->db->order_by('absen.tanggal', 'asc');
$this->db->limit($limit, $offset);
return $this->db->get();
}
[code]

when i used debug with your suggest the array data is show, but in the grid the data still not show and the error still same..



thanks
#6

[eluser]aprij4nto13[/eluser]
this the full application attachment
#7

[eluser]aprij4nto13[/eluser]
there is anyone can answer my question, thx..
#8

[eluser]Unknown[/eluser]
just open your control, you have wrong on sql sintax :

"$data['options_matkul'][$row->id_matkul] = $row->nm_matkul(this field on your table) "

ok, made




Theme © iAndrew 2016 - Forum software by © MyBB