hi im doing a project on online table reseration. im using a table "reservation" to store the table details of reserved table
+--------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+----------------+
| reserve_id | int(15) | NO | PRI | NULL | auto_increment |
| member_id | int(15) | NO | | NULL | |
| table_id | int(15) | NO | | NULL | |
| reserve_date | date | NO | | NULL | |
| reserve_time | varchar(50) | YES | | NULL | |
+--------------+-------------+------+-----+---------+----------------+
these are the values inserted as the user tries to reserve
+------------+-----------+----------+--------------+--------------+
| reserve_id | member_id | table_id | reserve_date | reserve_time |
+------------+-----------+----------+--------------+--------------+
| 21 | 1 | 3 | 2014-05-01 | Lunch |
| 22 | 1 | 3 | 2014-05-01 | Lunch |
| 23 | 1 | 4 | 2014-05-01 | Dinner |
| 25 | 1 | 3 | 2014-02-02 | Lunch |
+------------+-----------+----------+--------------+--------------+
what i want is if the member id of 1, reserve table of id "3 " on date 1-05-2014 for lunch and if member id of "2" also tries to reserve it should nt be reserved how to do ?
hiiiiii@
0
Junior Poster in Training
Recommended Answers
Jump to PostWhat what you're saying is member_id = 1 should have priority over member_id =2
Jump to Postcheck for a booking at that date and period and for that table.
What you really want to do (I assume) is have a table to show data for a particular date and period (e.g. selected by dropdown fields). This shows available tables - so bookings can be made for …
Jump to PostMany ways to do it. If you go down the "times" route, then you need to be aware that although say 7.30 may be free, a booking may have been made for 6.30 or 8.30 - in which case a 7.30 booking for a particular table would be most unwise. …
Jump to PostI think you should put two timestamp columns book_from and book_upto
So that it will help you to easily query any conflict in booking very easily.
Jump to PostYou'll need a tables table:
Tablestable_id INT/PK
table_label CHAR/VARCHAR
periods TINYINT 1 (1=lunch,2=dinner,3=lunch and dinner)Bookingsbooking_id INT/PK
customer_id INT/FK
staff_id INT/FK
book_made_date DATETIME or INT (for unix timestamps)
book_for_date DATE
period TINYINT 1 (as for periods above)
[table_id INT/FK] - see belowAllowing for the booking …
All 27 Replies
iamthwee
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
urtrivedi
276
Nearly a Posting Virtuoso
hiiiiii@
0
Junior Poster in Training
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
diafol
hiiiiii@
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.