I use codeigniter calendar class and i am trying to display all reservations for the current month. In the field where the day is, I may have more than one result,and I would like to display them coma separated.
However, I get the following error message:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$reservationID
Filename: models/reservationcalendarmodel.php
Line Number: 81
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$reservationArrivalDate
Filename: models/reservationcalendarmodel.php
Line Number: 81
Error is displayed 10 times ( i expect 9 records from the database)
Here is the (relevant) code from the model:
function getReservations($year,$month) {
$currentHotelUser = $this->session->userdata('currentHotelUser');
$query = $this->db->query(
"SELECT r.*
FROM room r
LEFT JOIN (SELECT rr.roomID, re.reservationID,re.reservationArrivalDate
FROM reservationroom rr
LEFT JOIN reservation re ON re.reservationID = rr.reservationID
WHERE re.reservationArrivalDate LIKE('".$year."-".$month."-%'))
sq ON sq.roomID = r.roomID
WHERE r.hotelID = ".$currentHotelUser['hotelID']."
AND sq.reservationID IS NOT NULL
");
$cal_data = array();
foreach($query->result() as $row) {
// BELLOW IS THE LINE 81 WHERE THE ERROR IS
$cal_data[substr($row->reservationArrivalDate,8,2)]= $row->reservationID;
}
return $cal_data;
}
function generate($year,$month) {
$cal_data = $this->getReservations($year, $month);
$this->load->library('calendar', $this->conf);
return $this->calendar->generate($year,$month,$cal_data);
}
Here is the (relevant) code from the controller:
$this->load->model('ReservationCalendarModel');
$data['calendar'] = $this->ReservationCalendarModel->generate($year,$month);
Here is the (relevant) code from the view:
echo $calendar;
Did anyone know why do I get the above error?