Can anyone point me to some tutorials on managing time with PHP/MySQL.
Specifically I am building a meeting room scheduling application for my office and I am having difficulty how to manage the time issue. Things like checking to make sure a room is open when scheduling it for a meeting. So if someone schedules a room from 12 to 1 then someone else attempts to schedule the room at 12:30, how do I have PHP check and see that time falls within the range of a time that the room is already in use?
It is a MySQL back end so would I be able to use SQL command to check this?
Any help would be greatly appreciated.
Dealing with Time
Moderator: General Moderators
- mrvanjohnson
- Forum Contributor
- Posts: 137
- Joined: Wed May 28, 2003 11:38 am
- Location: San Diego, CA
Code: Select all
create table shedules (datetime start, datetime end,....);Code: Select all
//adding shedule
//$start contains requested start time, $end - end time
$res= mysql_query("select count(*) from shedules where $end between start and end or $start between start and end");
$qres=mysql_fetch_row();
if(!$qres){
// room is open
} else {
// already sheduled
}- mrvanjohnson
- Forum Contributor
- Posts: 137
- Joined: Wed May 28, 2003 11:38 am
- Location: San Diego, CA