Join 300,406 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,586 people online right now. Registration is fast and FREE... Join Now!
I have a dynamic calendar I have been re-writting. (I realize there are lots of free ones online but I needed one to do something else.) this calendar is only a part of the whole.I have everyhting working fine. I have it advancing to the next month and looks really nice. I can't get my query to work. I had it throwing an error, but now it is just spitting out data I didn't want. I will post the code that is the problem, then the whole code for the calendar.
This is the problem code:
CODE
<cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery>
</tr> <cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery> <cfset ThisDay = 0> <cfloop condition = "ThisDay LTE Days"> <tr class = "calendar">
<cfloop from = "1" to = "7" index = "LoopDay"> <!--- This turns each day into a hyperlink if it is a current or future date ---> <cfoutput> <cfif thisday is day(now())> <b>#ThisDay#</b> <cfelse> <cfif listFind(days,thisday)> <a href="##"><b>thisday</b></a> <cfelse> #thisday# </cfif> </cfif> </cfoutput> <cfif ThisDay IS 0> <cfif DayOfWeek(ThisMonthYear) IS LoopDay> <cfset ThisDay = 1> </cfif> </cfif> <!---If the ThisDay value is still 0, or is greater than the number of days in the month, display nothing in the column. Otherwise, dispplay the day of the mnth and increment the value.---> <cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)> <cfoutput> <!--- I choose to highlight the current day of the year using an IF-ELSE. ---> <cfif (#ThisDay# EQ #currentday#) AND (#month# EQ #startmonth#) AND (#year# EQ #startyear#)> <td align = "center" bgcolor="##FFFFCC"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> <cfelse> <td align = "center"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> </cfif> </cfoutput> <cfset ThisDay = ThisDay + 1> <cfelse> <td></td> </cfif> </cfloop> </tr> </cfloop> </table> </td> </tr> </table> </td> </tr> </table>
Can anyone help me with this? It is the last thing I need to get working and it is driving me crazy. Right now, this code does this:0
0
0
0
1
1
2
2
3
3
and then at the bottom of 32 numbers and doubles of numbers, is the calendar. So my llink code is making it do this.
I realize this is a lot of code. Sorry it is so large. This has been driving me crazy for 3 days now and I can't figure out the problem or how to make it loop through my db records to get the link. Everything else works!
I have a dynamic calendar I have been re-writting. (I realize there are lots of free ones online but I needed one to do something else.) this calendar is only a part of the whole.I have everyhting working fine. I have it advancing to the next month and looks really nice. I can't get my query to work. I had it throwing an error, but now it is just spitting out data I didn't want. I will post the code that is the problem, then the whole code for the calendar.
This is the problem code:
CODE
<cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery>
</tr> <cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery> <cfset ThisDay = 0> <cfloop condition = "ThisDay LTE Days"> <tr class = "calendar">
<cfloop from = "1" to = "7" index = "LoopDay"> <!--- This turns each day into a hyperlink if it is a current or future date ---> <cfoutput> <cfif thisday is day(now())> <b>#ThisDay#</b> <cfelse> <cfif listFind(days,thisday)> <a href="##"><b>thisday</b></a> <cfelse> #thisday# </cfif> </cfif> </cfoutput> <cfif ThisDay IS 0> <cfif DayOfWeek(ThisMonthYear) IS LoopDay> <cfset ThisDay = 1> </cfif> </cfif> <!---If the ThisDay value is still 0, or is greater than the number of days in the month, display nothing in the column. Otherwise, dispplay the day of the mnth and increment the value.---> <cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)> <cfoutput> <!--- I choose to highlight the current day of the year using an IF-ELSE. ---> <cfif (#ThisDay# EQ #currentday#) AND (#month# EQ #startmonth#) AND (#year# EQ #startyear#)> <td align = "center" bgcolor="##FFFFCC"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> <cfelse> <td align = "center"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> </cfif> </cfoutput> <cfset ThisDay = ThisDay + 1> <cfelse> <td></td> </cfif> </cfloop> </tr> </cfloop> </table> </td> </tr> </table> </td> </tr> </table>
Can anyone help me with this? It is the last thing I need to get working and it is driving me crazy. Right now, this code does this:0
0
0
0
1
1
2
2
3
3
and then at the bottom of 32 numbers and doubles of numbers, is the calendar. So my llink code is making it do this.
I realize this is a lot of code. Sorry it is so large. This has been driving me crazy for 3 days now and I can't figure out the problem or how to make it loop through my db records to get the link. Everything else works!
Thank you!
try CreateOdbcDate() around your dates ie #CreateOdbcDate(firstOfTheMonth)#
QUOTE(irishphoenix @ 20 May, 2009 - 12:25 PM)
I have a dynamic calendar I have been re-writting. (I realize there are lots of free ones online but I needed one to do something else.) this calendar is only a part of the whole.I have everyhting working fine. I have it advancing to the next month and looks really nice. I can't get my query to work. I had it throwing an error, but now it is just spitting out data I didn't want. I will post the code that is the problem, then the whole code for the calendar.
This is the problem code:
CODE
<cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery>
</tr> <cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery> <cfset ThisDay = 0> <cfloop condition = "ThisDay LTE Days"> <tr class = "calendar">
<cfloop from = "1" to = "7" index = "LoopDay"> <!--- This turns each day into a hyperlink if it is a current or future date ---> <cfoutput> <cfif thisday is day(now())> <b>#ThisDay#</b> <cfelse> <cfif listFind(days,thisday)> <a href="##"><b>thisday</b></a> <cfelse> #thisday# </cfif> </cfif> </cfoutput> <cfif ThisDay IS 0> <cfif DayOfWeek(ThisMonthYear) IS LoopDay> <cfset ThisDay = 1> </cfif> </cfif> <!---If the ThisDay value is still 0, or is greater than the number of days in the month, display nothing in the column. Otherwise, dispplay the day of the mnth and increment the value.---> <cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)> <cfoutput> <!--- I choose to highlight the current day of the year using an IF-ELSE. ---> <cfif (#ThisDay# EQ #currentday#) AND (#month# EQ #startmonth#) AND (#year# EQ #startyear#)> <td align = "center" bgcolor="##FFFFCC"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> <cfelse> <td align = "center"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> </cfif> </cfoutput> <cfset ThisDay = ThisDay + 1> <cfelse> <td></td> </cfif> </cfloop> </tr> </cfloop> </table> </td> </tr> </table> </td> </tr> </table>
Can anyone help me with this? It is the last thing I need to get working and it is driving me crazy. Right now, this code does this:0
0
0
0
1
1
2
2
3
3
and then at the bottom of 32 numbers and doubles of numbers, is the calendar. So my llink code is making it do this.
I realize this is a lot of code. Sorry it is so large. This has been driving me crazy for 3 days now and I can't figure out the problem or how to make it loop through my db records to get the link. Everything else works!
I have a dynamic calendar I have been re-writting. (I realize there are lots of free ones online but I needed one to do something else.) this calendar is only a part of the whole.I have everyhting working fine. I have it advancing to the next month and looks really nice. I can't get my query to work. I had it throwing an error, but now it is just spitting out data I didn't want. I will post the code that is the problem, then the whole code for the calendar.
This is the problem code:
CODE
<cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery>
</tr> <cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery> <cfset ThisDay = 0> <cfloop condition = "ThisDay LTE Days"> <tr class = "calendar">
<cfloop from = "1" to = "7" index = "LoopDay"> <!--- This turns each day into a hyperlink if it is a current or future date ---> <cfoutput> <cfif thisday is day(now())> <b>#ThisDay#</b> <cfelse> <cfif listFind(days,thisday)> <a href="##"><b>thisday</b></a> <cfelse> #thisday# </cfif> </cfif> </cfoutput> <cfif ThisDay IS 0> <cfif DayOfWeek(ThisMonthYear) IS LoopDay> <cfset ThisDay = 1> </cfif> </cfif> <!---If the ThisDay value is still 0, or is greater than the number of days in the month, display nothing in the column. Otherwise, dispplay the day of the mnth and increment the value.---> <cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)> <cfoutput> <!--- I choose to highlight the current day of the year using an IF-ELSE. ---> <cfif (#ThisDay# EQ #currentday#) AND (#month# EQ #startmonth#) AND (#year# EQ #startyear#)> <td align = "center" bgcolor="##FFFFCC"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> <cfelse> <td align = "center"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> </cfif> </cfoutput> <cfset ThisDay = ThisDay + 1> <cfelse> <td></td> </cfif> </cfloop> </tr> </cfloop> </table> </td> </tr> </table> </td> </tr> </table>
Can anyone help me with this? It is the last thing I need to get working and it is driving me crazy. Right now, this code does this:0
0
0
0
1
1
2
2
3
3
and then at the bottom of 32 numbers and doubles of numbers, is the calendar. So my llink code is making it do this.
I realize this is a lot of code. Sorry it is so large. This has been driving me crazy for 3 days now and I can't figure out the problem or how to make it loop through my db records to get the link. Everything else works!
Thank you!
try CreateOdbcDate() around your dates ie #CreateOdbcDate(firstOfTheMonth)#
QUOTE(irishphoenix @ 20 May, 2009 - 12:25 PM)
I have a dynamic calendar I have been re-writting. (I realize there are lots of free ones online but I needed one to do something else.) this calendar is only a part of the whole.I have everyhting working fine. I have it advancing to the next month and looks really nice. I can't get my query to work. I had it throwing an error, but now it is just spitting out data I didn't want. I will post the code that is the problem, then the whole code for the calendar.
This is the problem code:
CODE
<cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery>
</tr> <cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> <cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)> <cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events Where eventDate Between #firstOfTheMonth# and #endOfTheMonth# </cfquery> <cfset ThisDay = 0> <cfloop condition = "ThisDay LTE Days"> <tr class = "calendar">
<cfloop from = "1" to = "7" index = "LoopDay"> <!--- This turns each day into a hyperlink if it is a current or future date ---> <cfoutput> <cfif thisday is day(now())> <b>#ThisDay#</b> <cfelse> <cfif listFind(days,thisday)> <a href="##"><b>thisday</b></a> <cfelse> #thisday# </cfif> </cfif> </cfoutput> <cfif ThisDay IS 0> <cfif DayOfWeek(ThisMonthYear) IS LoopDay> <cfset ThisDay = 1> </cfif> </cfif> <!---If the ThisDay value is still 0, or is greater than the number of days in the month, display nothing in the column. Otherwise, dispplay the day of the mnth and increment the value.---> <cfif (ThisDay IS NOT 0) AND (ThisDay LTE Days)> <cfoutput> <!--- I choose to highlight the current day of the year using an IF-ELSE. ---> <cfif (#ThisDay# EQ #currentday#) AND (#month# EQ #startmonth#) AND (#year# EQ #startyear#)> <td align = "center" bgcolor="##FFFFCC"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> <cfelse> <td align = "center"> <cfset dayview = #dateformat(createdate(#year#, #month#, #thisday#), "mm/dd/yyyy")#> <font face="Arial, Helvetica, sans-serif" color="##000000" size="2">#ThisDay#</font> </td> </cfif> </cfoutput> <cfset ThisDay = ThisDay + 1> <cfelse> <td></td> </cfif> </cfloop> </tr> </cfloop> </table> </td> </tr> </table> </td> </tr> </table>
Can anyone help me with this? It is the last thing I need to get working and it is driving me crazy. Right now, this code does this:0
0
0
0
1
1
2
2
3
3
and then at the bottom of 32 numbers and doubles of numbers, is the calendar. So my llink code is making it do this.
I realize this is a lot of code. Sorry it is so large. This has been driving me crazy for 3 days now and I can't figure out the problem or how to make it loop through my db records to get the link. Everything else works!
Thank you!
I have that in my query now. But I am not getting my link, no errors anymore, but the link isn't appearing with my if statement. this is what I changed things to with my query and if statement:
CODE
<cfquery name="CaleventRec" datasource="#APPLICATION.dataSource#"> SELECT events.eventDate, events.ID AS ID FROM events WHERE eventDate = #CreateODBCDate("07/12/2005")# </cfquery>
and none of these work. Should I be compairing the actualy date with my db date in my where statement? or is there a way to get this if statement to work? this is the final hurdle. thank you for the help