richcleverley
MIS
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
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