Friday, 15 May 2015

php - Check two date was not between two another date + MYSQl -



php - Check two date was not between two another date + MYSQl -

i writhing query hotel reservation , booking scheme got problem selecting rooms not reserved between 2 date . query alike it's not working , query homecoming noting have 3 room room type 1 . sql fiddle : http://sqlfiddle.com/#!2/b97419

select tbl_room.room_no, tbl_room.type_id, tbl_reservation.room_id tbl_room left bring together tbl_reservation on tbl_room.id = tbl_reservation.room_id ( ( tbl_reservation.checkin_data < '" . $checkin . "' , tbl_reservation.checkout_data < '" . $checkin . "' ) or ( tbl_reservation.checkin_data > '" . $checkout . "' , tbl_reservation.checkout_data > '" . $checkout . "' ) ) , tbl_room.type_id =1

thanks helping , sorry bad english language .

try this

select tbl_room.room_no, tbl_room.type_id, tbl_room.id, tr.id reserv_status tbl_room left bring together tbl_reservation tr on tbl_room.id = tr.room_id , ( (tr.checkin_data <= "'$checkin'" , tr.checkout_data >= "'$checkin'") or (tr.checkin_data <= "'$checkout'" , tr.checkout_data >= "'$checkout'") ) tbl_room.type_id =1 , tr.id null

php mysql

No comments:

Post a Comment