mini-Calendar not passing proper ID's
Hello;
I have posted about this little calendar before. But then, I didn't have anything really working, now, I actually have it passing the proper dates from the db and making links in the day an event falls on.... BUT it passes the same ID to all the days in the month instead of the ID or the record it is pulling from.Can anyone help me figure out what I need to add to this to make it separate out the proper ID to link to another dynamic page? I believe it is either my query, or I need to make a cfset that makes the day eq ID or something. I'm not sure and not sure how to write that.
Here is my code:
<cfoutput>
<table border="1" width="100%" cellpadding="0" cellspacing="0">
<tr>
<cfloop index="x" from="1" to="7">
<!--- Change the days of the week to be shorter--->
<td><FONT face="Arial, Helvetica, sans-serif" color="##000000" size="2">#DateFormat(x, "ddd")#</FONT></td>
</cfloop>
</tr>
</cfoutput>
<cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)>
<!--- Add new variable for the end of the month--->
<cfset endOfTheMonth = createdatetime(year(now()), month(now()), #daysinmonth(firstOfTheMonth)#, 23, 59, 59)>
<!--- Query the database and search between the start and end--->
<CFQUERY datasource="#APPLICATION.dataSource#" Name="get_dates">
Select ID, eventDate, Day(eventDate) AS dd
From events
Where eventDate Between #firstOfTheMonth# and #endOfTheMonth#
</CFQUERY>
<!--- set the day from the list in the db--->
<cfset day = ValueList(get_dates.dd)>
<!---<cfoutput>#day#</cfoutput>--->
<cfset dow = dayofWeek(firstOfTheMonth)>
<cfset pad = dow - 1>
<cfoutput>
<tr>
</cfoutput>
<cfif pad gt 0>
<cfoutput>
<td colspan="#pad#"> </td>
</cfoutput>
</cfif>
<cfset days = daysInMonth(now())>
<cfset counter = pad + 1>
<cfloop index="x" from="1" to="#days#">
<cfif x is day(now())>
<cfoutput><td bgcolor="##f1f09c"></cfoutput>
<cfelse>
<cfoutput><td></cfoutput>
</cfif>
<cfoutput>
<!--- Here we compare the day list to the days being outputed if there is a match we link it.--->
<cfif x is day(now())>
<cfif listFind(day,x)>
<a href="/detail.cfm?dd=#get_dates.ID#" class="dateNav"><b>[#x#]</b></a>
<cfelse>
<FONT face="Arial, Helvetica, sans-serif" color="##000000" size="2"><b>#x#</b></FONT>
</cfif>
<cfelse>
<cfif listFind(day,x)>
<a href="/detail.cfm?dd=#get_dates.ID#" class="dateNav"><b>[#x#]</b></a>
<cfelse>
<FONT face="Arial, Helvetica, sans-serif" color="##000000" size="2">#x#</FONT>
</cfif>
</cfif>
</td>
</cfoutput>
<cfset counter = counter + 1>
<cfif counter is 8>
<cfoutput></tr></cfoutput>
<cfif x lt days>
<cfset counter = 1>
<cfoutput>
<tr>
</cfoutput>
</cfif>
</cfif>
</cfloop>
<cfif counter is not 8>
<cfset endPad = 8 - counter>
<cfoutput>
<td colspan="#endPad#"> </td>
</cfoutput>
</cfif>
<cfoutput>
</table>
</cfoutput>
I know this is a lot of code. The problem is from my query down. Really everything before that is working, it is just not passing proper ID's to the proper records. They all have the same ID.
Can anyone help me?
Thank you
CFmonger
