Hi
I asked about this the other day, but I'm having problems getting it working
this is the form:
<cfquery datasource="#dsn#" name="artforms">
SELECT id, artform
FROM artforms
ORDER BY artform
</cfquery>
<form...>
<cfoutput query="artforms">
<tr>
<td>#artform#</td>
<td><input type="checkbox" name="artform" value="#id#"></td>
</tr>
</cfoutput>
<tr>
<td> </td>
<td><input type="submit" name="addartforms" value="add information"
onclick="this.value='adding...';"></td>
</tr>
</form>
and this is the code to process it:
<cfif IsDefined("form.fieldnames")>
<CFLOCK
SCOPE="session"
TIMEOUT="30"
TYPE="Exclusive">
<cfif IsDefined("form.userid")>
<cfset userid = #form.userid#>
<cfelse>
<cfset userid = #session.userid#>
</cfif>
// ie the above is either a value passed from a hidden form field, or is the user's
sessionid
<cfquery datasource="#dsn#">
DELETE *
FROM artformjoin
WHERE userid = #variables.userid#
</cfquery>
// whatever their artform choices are curently, delete them before adding the choices
from the form. If they are adding for the first time the RC of the above query will be
0, but that doesn't matter
<cfoutput>
<cfloop index="field" LIST="#form.fieldnames#">
<cfif field IS NOT 'addartforms' AND field IS NOT 'userid' AND field IS NOT 'cfid'
AND field IS NOT 'cftoken' AND field IS NOT 'page' AND field IS NOT 'action'>
// ie if the form field is _not_ one of the hidden variables being passed
<cfquery datasource="#dsn#">
INSERT INTO artformjoin (userid, artformid) VALUES (#variables.userid#, #field#)
</cfquery>
</cfif>
</cfloop>
</cfoutput>
</CFLOCK>
</cfif>
and I'm getting this error:
ODBC Error Code = 07001 (Wrong number of parameters)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Hint: The cause of this error is usually that your query contains a reference to a
field which does not exist. You should verify that the fields included in your query
exist and that you have specified their names correctly.
SQL = "INSERT INTO artformjoin (userid, artformid) VALUES (16, ARTFORM)"
it's trying to write the name of the field rather than its value... (ie the table is
expecting a number and it's getting text)
anyone any ideas?
TIA
Ian W
Ian Westbrook,
FutureDream Media Limited,
(W): www.futuredream.net
(E): [EMAIL PROTECTED]
(T): +44 (0) 1303 258 985
(M): 07939 510 812
This message may contain information which is legally privileged and/or confidential.
If you are not the intended recipient, you are hereby notified that any unauthorised
disclosure, copying, distribution or use of this information is strictly prohibited.
Such notification notwithstanding any comments, opinions, information or conclusions
expressed in this message are those of the originator, not of FutureDream Media Ltd,
unless otherwise explicitly and independently indicated by an authorised
representative of FutureDream Media Ltd.