Forum Moderators: coopster

Message Too Old, No Replies

calender - availability chart

         

helenp

7:22 pm on Nov 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi,
I have availability on my site in an calendar and I manually introduces if available for that day or not.
But I want to do it autmatically.

At the moment I have the reservations in an database table, I have arrival in one column and departures in another column, both date types.

Anybody know how to do the script for the web, or at least give me an idea on where to start....

Salsa

9:08 pm on Nov 23, 2004 (gmt 0)

10+ Year Member



To first find your occupancy, how about:

SELECT count(*) FROM table WHERE arrival < '$calendar_date' AND departure > '$calendar_date'

Here I'm assuming first setting:

$calendar_date = 'ccyy-mm-dd'; // date you want to find occupancy for.

The result from this should give you the occupancy count for $calendar_date. Subtract that from whatever the total is, and it should give you the number of availabilities.

Depending on when your changeover time is, you might need to use <= and/or >= instead of < and >.

I hope this helps.

helenp

9:50 pm on Nov 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



thanks,
that was more or less what I was thinking on,
but I think the worst will be the php part,...
the calendar.

Now it is in an normal html table,...how to do an php calendar and put the dates in the calendar..

Any suggestions about that?