[eluser]Jeffrey04[/eluser]
im doing a scheduler app and is suppose to avoid user to schedule events without interfering his other events. so i tried retrieving a set of records from the database as follows to find out whether there is any interference
Code:
$this->db->select('event_id')
->from('cal_event')
->where('event_end >=', $new_start_date) // overlappin at the end
->where('event_end <=', $new_end_date)
->or_where('event_start <=', $new_end_date) // overlappin at the beginning
->where('event_start >=', $new_start_date)
->or_where('event_start <=', $new_start_date) // overlappin in the middle
->where('event_end >=', $new_end_date);
may I know what is the problem with the query? I am getting a record with event_end = 23jan and event_start = 22jan when comparing with event_start = 22feb and event_end = 23feb