B
Brian
Hi,
Total newb here so my apologies if I break any scripting standards. I
have some code that pulls reservation times from a database. It is
supposed to print green cells in a table until the time of the
reservation and then print red cells until the reserved period has
ended and then continue printing green cells. Example: reservation
period is 11:00 AM to 2:00 PM. Print green cells until representing
every half hour until 11. Print red cells until 2 then print green
cells until end of day(7 PM). I ran into a problem and statically
assigned values to take the DB out of the loop. Below is the code. Can
anyone tell me why is it that if the reservation start time is before
9:30 AM that the loop breaks and doesn't print red cells. Sorry for
being lengthy,...
Brian
<%
vtime = TimeValue(#7:00#)
btime = TimeValue(#9:30#)
Response.Write "<table border=1>"
For i = 1 to 30
If vtime > btime AND vtime < TimeValue(#12:31#) Then
Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 5) & "</td>"
vtime = DateAdd("n", 30, vtime)
Else
Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 4) & "</td>"
vtime = DateAdd("n", 30, vtime)
End If
Next
Response.Write "</tr>"
vtime = TimeValue(#7:00#)
stime = TimeValue(#8:00#)
btime = TimeValue(#9:30#)
etime = TimeValue(#11:00#)
Response.Write "<tr height=20>"
Do while Left(vtime, 4) <> Left(stime, 4)
Response.Write "<td bgcolor='#3CB371'></td>"
vtime = DateAdd("n", 30, vtime)
Loop
Do while Left(vtime, 4) <= Left(etime, 5)
Response.Write "<td bgcolor='#F08080'></td>"
vtime = DateAdd("n", 30, vtime)
Loop
Response.Write "</table>"
%>
Total newb here so my apologies if I break any scripting standards. I
have some code that pulls reservation times from a database. It is
supposed to print green cells in a table until the time of the
reservation and then print red cells until the reserved period has
ended and then continue printing green cells. Example: reservation
period is 11:00 AM to 2:00 PM. Print green cells until representing
every half hour until 11. Print red cells until 2 then print green
cells until end of day(7 PM). I ran into a problem and statically
assigned values to take the DB out of the loop. Below is the code. Can
anyone tell me why is it that if the reservation start time is before
9:30 AM that the loop breaks and doesn't print red cells. Sorry for
being lengthy,...
Brian
<%
vtime = TimeValue(#7:00#)
btime = TimeValue(#9:30#)
Response.Write "<table border=1>"
For i = 1 to 30
If vtime > btime AND vtime < TimeValue(#12:31#) Then
Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 5) & "</td>"
vtime = DateAdd("n", 30, vtime)
Else
Response.Write "<td bgcolor='#F0E68C'>" & Left(vtime, 4) & "</td>"
vtime = DateAdd("n", 30, vtime)
End If
Next
Response.Write "</tr>"
vtime = TimeValue(#7:00#)
stime = TimeValue(#8:00#)
btime = TimeValue(#9:30#)
etime = TimeValue(#11:00#)
Response.Write "<tr height=20>"
Do while Left(vtime, 4) <> Left(stime, 4)
Response.Write "<td bgcolor='#3CB371'></td>"
vtime = DateAdd("n", 30, vtime)
Loop
Do while Left(vtime, 4) <= Left(etime, 5)
Response.Write "<td bgcolor='#F08080'></td>"
vtime = DateAdd("n", 30, vtime)
Loop
Response.Write "</table>"
%>