I have created a function in my views and have tried to make a query within the php function but i do not know I am getting and unexpected error which was never been seen in my entire career can anyone help me out to get rid from this error?
Severity: Error --> Using $this when not in object context /application/views/includes/create_calendar.php 51
This is my controller
class Booking extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper(array("form", "url"));
$this->load->library('session');
$this->load->database();
}
public function get_calendar() {
$this->load->view('includes/create_calendar');
}
}
This is the file in which I am trying to run a query views/includes/create_calendar.php
function getCalender($year = '',$month = '') {
$sql = $this->db->get('calendar');
if($day == $sql->row()->day_off) { $per_off = $sql->row()->per_off; }
echo "<p>".$day." Off</p>";
}