Rezervasyon sistemi PHP + SQL ile büyük problem

0 Cevap php

Ben şimdi özel odalar bölümü yapıldı, yeni bir rezervasyon sistemi oluşturma ve ben şimdi Yurdu (paylaşım odası) parçası var.

Sistem böyle çalışır:

  1. Yurt yerleştirin gelen gün + gün terk + kaç kişi

  2. the system checks in the DB (of MYSQL by the way) if the is free room. now how it checks? in the DB has coulmn of dates - one date is person. for example we have a dorm with those dates: 05/08, 05/08, 05/08, 05/08, 06/08, 06/08, 06/08, 06/08, 07/08, 07/08, 07/08, 07/08 - so there is 4 persons in dorm 05-07/08. for example if this room with 10 persons there is 4 of 10. now if you insert 7 people you dont have place. (it will be 11 of 10).

  3. Sistem müsait odaları döndürür.

Now I want to do the next thing: If there is 2 dorms. all of them place to 10 persons. all of them with 8 persons of 10. now coming 4 persons and want to register.. it wont give them because it checks dorm-dorm.. I want to do that the system will calculate the free places (there is 10-8 + 10-8 = 4 in 2 dorms). there is ideas?

My english its not very good I hope you will understand me, THANK YOU VERY MUCH!

EDIT:

Ben veritabanında yurt eklediğinizde:

ID | room_type|            persons                   | dates
------------------------------------------------------------------------
X  |  Dorm    |How many the dorm contain. not change.| of persons coming

Eğer aynı 5 tarihler varsa = Bu tarihte yurt içinde 5 kişi var. örneğin.

0 Cevap