Welcome Guest, Not a member yet? Register   Sign In
Check Available Rooms For Selected Dates
#1

Hello there,

Working on a small hotel reservation system and got stucked on "check availability" part and need your help.

My DB Structure : 

1- ROOMS table :
    room_id  - room_no   -  room_capacity  

2- RESERVATION table :
    reservation_id - days - daily_price - room_no - customer_id 

room_no is the FK.

I can get the result of the rooms which are booked on selected dates but I cannot get the ones which are available (which are not booked for those days).

I have tried lots of things upon my searchs but let me write here some example : 

My Modal :


PHP Code:
public function check_room_availability($date_in$date_out) {

 
       $query $this->db->select('*')->from('rooms')
 
       ->join('reservation''rooms.room_no = reservation.room_no''LEFT')
 
       ->where('reservation.days >='$date_in)
 
       ->where('reservation.days <='$date_out)
 
       ->order_by('reservation.room_no''ASC')
 
       ->get()->result();
 
       
return $query

Thanks in advance.
Reply


Messages In This Thread
Check Available Rooms For Selected Dates - by demyr - 05-29-2019, 03:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB