View Full Version : Booking system error!

01-28-2007, 12:01 AM
Hi all!
I'm in the process of writing an app to allow online bookings. It must also show when resources are booked in a calendar. This is done by changing the background colour to red for unavailable and green for available. Resources are booked per day, not per hour.
My code below works fine, EXCEPT when a booking period moves from one month into the next, in which case only dates booked in the beginning month show up. The db has no support for individual calendar dates including unbooked dates - it only carries the start and end date for each resource.

Other than this extremely frustrating issue its fine! PLEASE HELP????

Many thanks in advance!

Code below:
set rsCal = cnndata.Execute("SELECT * FROM tblReservation")

While Not rsCal.EOF

If Not rsCal.EOF then HouseCO=rsCal("codate")
If Not rsCal.EOF then HouseCI = rsCal("cidate")
varDateNow = Cdate(varDateNow)

If Not rsCal.EOF AND varCurrentDate =< CDATE(CurrentDay & "/" & MyMonth & "/" & MyYear) then

If Not rsCal.EOF AND HouseCI = CDATE(CurrentDay & "/" & MyMonth & "/" & MyYear) then varBackground="red"


If HouseCO = CDATE(CurrentDay & "/" & MyMonth & "/" & MyYear) then varBackground="green"

End if

If Not rsCal.EOF then rsCal.MoveNext



response.write "<td bgcolor='" & varBackground & "'"

01-29-2007, 01:46 PM
You use a number of variables in that code that are clearly populated somewhere else. My guess is that if you response.write() some of those variables, you'll find something in the output that doesn't make sense.