CodeIgniter Forums
time interval clash - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: time interval clash (/showthread.php?tid=7570)



time interval clash - El Forum - 04-15-2008

[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


time interval clash - El Forum - 04-15-2008

[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?


time interval clash - El Forum - 04-15-2008

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


time interval clash - El Forum - 04-15-2008

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