How can I select tariff in database depending on the date?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
z_cool
Forum Newbie
Posts: 6
Joined: Wed May 24, 2006 12:56 am

How can I select tariff in database depending on the date?

Post by z_cool »

hi everyone,

Am a web developper in eco-tourism and i've just start to create database driver
website, where peoples can have a free quote to come on holiday in my country.
My problem is that, when someone request a quote after s/he has filled the quotation form. My php script need to check the arrival date when peoples will come. As in the hotel there's two seasons; one low and the other high. These two seasons have different prices. If s/he come in the low season the script give s/he the low prices else if s/he come in the high season s/he will have high prices.

Is there someone who can help please??
z_cool
Forum Newbie
Posts: 6
Joined: Wed May 24, 2006 12:56 am

How can I select tariff in database depending on the date?

Post by z_cool »

hi..

There's nobody who can help me on that issue?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Its fairly easy.

Store both sets of prices in a table

Then...

Psuedo code

Code: Select all

// Check current date

if( date > arrivalDate)
{
    // select one set of prices
} else {
    //select other set of prices
}
NOTE: Please DO NOT bump a post half and hour after posting your question!! :twisted:
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:3. Do not make multiple, identical posts. This is viewed as spam and will be deleted.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:4. All users of any level are restricted to bumping (as defined here) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not recieve a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.
Post Reply