House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Select box causing query error?

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Garu L
05/22/2008 02:47 PM

Referring to this thread http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56335#305025 I wanted to pass a variable to a dynamic select box, so I changed this: <option value="'#SITEID#'" selected=#sid#> to <option value="#SITEID#"<cfif SITEID EQ sid> selected="selected"</cfif>> and now get "Error Executing Database Query...... Too few parameters.  Expected 1." The query: SELECT <CFLOOP list="#form.parameters#" index="i">sitedata.#i#,</CFLOOP>   site.coordinates_n, site.coordinates_w, sitedata.monitordate, site.name, site.siteid   FROM site INNER JOIN sitedata   ON site.siteid = sitedata.siteid   WHERE sitedata.SITEID IS NOT NULL   <CFIF form.siteid gt "">AND sitedata.SITEID in (#PreserveSingleQuotes(form.siteid)#)</CFIF>   <CFIF startdate gt "" AND enddate gt "">AND sitedata.monitordate >= #startdate# and sitedata.monitordate <= #enddate#</CFIF>   <CFIF startdate gt "" AND enddate is "">AND sitedata.monitordate >= #startdate#</CFIF>   ORDER BY sitedata.monitordate, sitedata.siteid I admit I'm not a CF or SQL expert!  I'm guessing it has something to do with the cfloop.  Hoping this is something simple I've overlooked... TIA

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Garu L
05/22/2008 02:47 PM

Referring to this thread http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56335#305025 I wanted to pass a variable to a dynamic select box, so I changed this: <option value="'#SITEID#'" selected=#sid#> to <option value="#SITEID#"<cfif SITEID EQ sid> selected="selected"</cfif>> and now get "Error Executing Database Query...... Too few parameters.  Expected 1." The query: SELECT <CFLOOP list="#form.parameters#" index="i">sitedata.#i#,</CFLOOP>   site.coordinates_n, site.coordinates_w, sitedata.monitordate, site.name, site.siteid   FROM site INNER JOIN sitedata   ON site.siteid = sitedata.siteid   WHERE sitedata.SITEID IS NOT NULL   <CFIF form.siteid gt "">AND sitedata.SITEID in (#PreserveSingleQuotes(form.siteid)#)</CFIF>   <CFIF startdate gt "" AND enddate gt "">AND sitedata.monitordate >= #startdate# and sitedata.monitordate <= #enddate#</CFIF>   <CFIF startdate gt "" AND enddate is "">AND sitedata.monitordate >= #startdate#</CFIF>   ORDER BY sitedata.monitordate, sitedata.siteid I admit I'm not a CF or SQL expert!  I'm guessing it has something to do with the cfloop.  Hoping this is something simple I've overlooked... TIA


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference