Problem looping insert query
I'm working on inserting a recordset up Google Calendar entries into my site database. I have a form set up that allows me to insert new entries into the data table, but when I try to loop the insert query over the Google recordset, I get nothing (no errors, but no entries added to database).
Here's my form, which both displays the values from the Google query and populates fields (mostly hidden) with those values to submit to the Insert query. There's also a line that checks to make sure the event hasn't been canceled (canceled events are still listed, the start and end times are just set to null values):
<form method="post" action="<cfoutput>#CurrentPage#</cfoutput>">
<table cellpadding="2" border="1">
<cfset thisRow = 0>
<cfloop query="band_events">
<cfif IsDefined("starttime") AND IsDefined("endtime") AND starttime NEQ "" AND endtime NEQ "">
<cfset thisRow = thisRow + 1>
<cfoutput>
<tr>
<td>#thisRow#</td>
<td><input name="update#thisRow#" type="checkbox" checked="checked" /></td>
<td><input name="calendar#thisRow#" type="hidden" value="Band" />Band</td>
<td><input name="creator#thisRow#" type="hidden" value="#authoremail#" />#authoremail#</td>
<td><input name="starttime#thisRow#" type="hidden" value="#starttime#" />#starttime#</td>
<td><input name="endtime#thisRow#" type="hidden" value="#endtime#" />#endtime#</td>
<td><input name="title#thisRow#" type="hidden" value="#title#" />#title#</td>
<td><input name="content#thisRow#" type="hidden" value="#content#" />#content#</td>
<td><input name="location#thisRow#" type="hidden" value="#where#" />#where#</td>
<td><input name="ID#thisRow#" type="hidden" value="#ID#" />#ID#</td>
<td><input name="published#thisRow#" type="hidden" value="#ISOToDateTime(published)#" />#ISOToDateTime(published)#</td>
<td><input name="updated#thisRow#" type="hidden" value="#ISOToDateTime(updated)#" />#ISOToDateTime(updated)#</td>
</tr>
</cfoutput>
</cfif>
</cfloop>
</table>
<input type="hidden" name="totalRows" value="#row#" />
<input type="submit" name="submit" value="Submit" />
<input type="hidden" name="update_events" value="update_events" />
</form>
Here's the action script. There's some extra code in there to convert some of the date formats Google uses, and to account for the differences in time zones between the Google values and local time:
<cfif StructKeyExists(form,"update_events")>
<cfset loopCount = form["totalRows"]>
<cfloop index="row" from="1" to="#loopCount#">
<cfset thisCalendar = form["calendar" & row]>
<cfset thisCreator = form["creator" & row]>
<cfset thisStarttime = form["starttime" & row]>
<cfset thisEndtime = form["endtime" & row]>
<cfif TimeFormat(thisStarttime,"hh:mm tt") EQ "12:00 AM" AND TimeFormat(thisEndtime,"hh:mm tt") EQ "12:00 AM">
<cfset thisAllDay = -1>
<cfelse>
<cfset thisAllDay = 0>
<cfset thisStarttime = DateAdd("h",5,thisStarttime)>
<cfset thisEndtime = DateAdd("h",5,thisEndtime)>
</cfif>
<cfset thisTitle = form["title" & row]>
<cfset thisContent = form["content" & row]>
<cfset thisLocation = form["location" & row]>
<cfset thisID = form["ID" & row]>
<cfset thisPublished = form["published" & row]>
<cfset thisUpdated = form["updated" & row]>
<cfquery datasource="ctband">
INSERT INTO Events (Calendar, Created_By, All_Day, Event_Start, Event_End, Title, Content, Location, ID, Published, Updated) Values (
<cfqueryparam value="#thisCalendar#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#thisCreator#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#thisAllDay#" cfsqltype="cf_sql_integer">,
<cfqueryparam value="#thisStarttime#" cfsqltype="cf_sql_timestamp">,
<cfqueryparam value="#thisEndtime#" cfsqltype="cf_sql_timestamp">,
<cfqueryparam value="#thisTitle#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#thisContent#" cfsqltype="cf_sql_clob">,
<cfqueryparam value="#thisLocation#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#thisID#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#thisPublished#" cfsqltype="cf_sql_timestamp">,
<cfqueryparam value="#thisUpdated#" cfsqltype="cf_sql_timestamp">)
</cfquery>
</cfloop>
</cfif>
I'm thinking there must be something pretty obvious I've screwed up, but I can't for the life of me find it. Any help would be appreciated!
JAW
