Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logic help needed

Status
Not open for further replies.
Jul 28, 2005
358
FR
Hi all,

I have a piece of logic I need to write but am not too sure where to start. If anyone can point me in the right direction I'd be very grateful.

Basically, I have a form that takes input for how many people are to stay in an appartment.

The user has the choice of whether they want a single property or multiple properties (if their group is large).

So, if they choose multiple properties, the script should query the database and come up with a list of properties that will hold that many people.

i.e. if 12 people are chosen, the results should be various appartments that have between them enough space for the 12 people.

The field that is queried is 'sleeps' wich has a numeric value, so I guess it should pick out properties like this: property1 has 3 in sleeps field, property2 has 4 in sleeps field (7 total at moment), property3 has 2 in sleeps field (9 total) etc. until total = 12 (or 13 - gives choice so that if an extra person joins the group there is no problem)

Does anyone have any idea how I would construct this, presumably I need to bring the properties into an array then do the maths.

Richard
 
in the piece of logic you must also consider which appartments you want to fill first, the large appartments or the smaller ones .

 
I'd take into account the number of couples/families, you don't want to be spliiting them up.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
and that mother in laws are put in a far away appartment as possible ;)
 
Preferably in a different country.lol.

Seriously though, it's not actually a problem as this is for corporate bookings so companies will sort that out for themselves.

I've got it to count the variable sleeps up to the amount of people being booked for, and it now holds the id numbers of the appartments is an array. Just need to make sure these are kept when it comes to booking.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top