date time compare in mysql and php for booking meeting -
i need book meeting room start date , end date of date+time type in mysql when ever user enters data, values stored in these format 2013-10-03 14:30:00 2013-10-03 16:30:00 (both start , end date) , along room number(example:2) stored.
now suppose user has made new entry again,
1)same time , and same booking room ( start_date : 2013-10-03 14:30:00 end_date: 2013-10-03 16:30:00) 2)different time , same booking room (start_date:2013-10-03 13:30:00 end_date: 2013-10-03 15:30:00) 3)different time , same booking room (start_date:2013-10-03 15:30:00 end_date: 2013-10-03 18:30:00)
in above case, should me error saying time not available booked.
what have done till :
select * calendar `room_no`='2' , (starttime between $start_date , '$start_date' or endtime between $start_date , $end_date)
thanks in advance.i new php , mysql.so if mistake have done please let me know.
at first it's difficult know exact problem is.
look @ query below. using between query between same variable names $start_date , '$start_date'.
select * calendar room_no
='2'
, (starttime between $start_date , '$start_date') or (endtime between $start_date , $end_date)
i think have wrong sql.
Comments
Post a Comment