Jump to content

Database Design for hotel management system


nitiphone2021
 Share

Go to solution Solved by Barand,

Recommended Posts

it's a good tutorial but how can I get the available room?

I tried to follow your logic but it's not work

This is my sql query from laravel

	$load_room = DB::table('tb_reservation_room')
	->rightJoin('tb_rooms', 'tb_rooms.id', '=', 'tb_reservation_room.room_id')
	->select('tb_rooms.id', 'tb_rooms.room_name')
	->whereDate('checkin_date','<',$checkin_date)
	->whereDate('checkin_date','>',$checkin_date)
->get();

Screen Shot 2022-02-12 at 15.23.47.png

Link to comment
Share on other sites

first I tried this code will show all rooms in system

	select `tb_rooms`.`id`, `tb_rooms`.`room_name` from `tb_reservation_room` right join `tb_rooms` on `tb_rooms`.`id` = `tb_reservation_room`.`room_id`
	

I tried this code but no any output

	select `tb_rooms`.`id`, `tb_rooms`.`room_name` from `tb_reservation_room` right join `tb_rooms` on `tb_rooms`.`id` = `tb_reservation_room`.`room_id` where `checkin_date` < '2022-02-12'
	

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.