Welcome Guest, Not a member yet? Register   Sign In
time interval clash
#1

[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
#2

[eluser]Jeffrey04[/eluser]
i can't delete my own topic? after coming back from work I think I've found the solution already... can somebody help deleting the topic?
#3

[eluser]xwero[/eluser]
No deletion is forbidden. You have to live with your mistakes until the end of days Wink
#4

[eluser]Jeffrey04[/eluser]
Big Grin ok~
this is my first time developing using CI for a project~
hopefully everything turns out fine~




Theme © iAndrew 2016 - Forum software by © MyBB