[EMAIL PROTECTED] (Chris Payne) writes:
> Basically what I mean is I have an orderform for rooms.  THey can select the
> date they arrive and the date they leave, but if they leave on a different
> month when the price is higher, the last day or however many will be a
> higher price, what I need is to not only calculate the flat price, but also
> take into account if their stay goes over a period of time when rooms are
> more than they are at other times of the year.
> So, they could book monday - friday, monday thru wednesday could be $50, but
> it needs to check and see if any of the dates - in this example - fall on a
> date that the prices are higher, so in this example thursday and friday
> would be $80 a night whereas monday thru wednesday would be $50.  It's hard
> to explain :-)

OK. I guess you have to check all the dates, then. You could do it by
starting with the first day, get the timestamp for that day
(mktime(0,0,0,m,d,y)), and then you can add 86400 (secs per day) to
this and check each day consecutively using e.g. the getdate()
function. (http://www.php.net/manual/en/function.getdate.php)

Something like (not tested):

// ...
$current_timestamp = mktime(0,0,0,$start_m,$start_d,$start_y);
// ...
  $this_date = getdate($current_timestamp);
  // $this_date now contains all the info you need
  // Now, check for month, day of week etc. and update as needed
  // ...
  $current_timestamp += 86400;

Faith, n:
        That quality which enables us to believe what we know to be

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to