Jump to content


This topic is now archived and is closed to further replies.


matching user input with db

Recommended Posts

hey guys,

well I posted in the PHP Help section and I was told to try my luck here as well.

I made a script for table reservations where a user enters how many they are and the script has to assign him a table. So for instance a user enters 5 and if in the database I have a table that seats 4 persons and another table that seats 8, the script has to assign him the table for 4 people, because it's a closer number. Now if I have a table for 4 and a table for 6, it has to assign him a table for 6 and so on. When the script assigns a table it also has to let the user what's the minimum amount of money the user has to spend to be able to reserve the table.

Here's a db example:

id  club_id  night_id  tbl_guests  tbl_x  min_price  full 
1        16          17              4      2        120  false
2        16          17              8      2        240  false

so tbl_guests is the table type (table that seats 4 people, 8 people, etc), tbl_x is the number of tables and min_price is the minimum amount they have to spend.

Is there a way to do this directly with a query?

Share this post

Link to post
Share on other sites
This topic is now closed to further replies.


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.