Copy link to clipboard
Copied
I'm checking through some old code, tidying it up a little and making sure everything is using cfqueryparam - I've got the following bit of code and not sure what to do with it - I know cf_sql_array is available but I can't find any examples of information on it (or if that's exactly what I should be looking at):
<cffunction name="myfunction" access="public" returntype="void" output="false"> |
<cfloop index="i" list="#visualList#">
<cfif form["visual" & i] neq "NA">
<cfquery name="assetVisualCheck" datasource="#APPLICATION.Config.dbdsnd#" username="#APPLICATION.Config.dbuname#" password="#APPLICATION.Config.dbpass#">
INSERT INTO assetVisual
(visualAssetID, visualBy, visualDate, visualResult)
Values ('#i#', '#cgi.REMOTE_USER#', now(), '#form["visual" & i]#')
</cfquery>
</cfif>
</cfloop> | |
</cffunction> |
list="#visualList#" should be a straightforward swap, #i# and #cgi.remote_user# don't need binding
'#form["visual" & i]#' is the bit I want to make sure is right. #form.visual1# is a "P", "F" or "X"
Am I overthinking this and it should just be
<cfqueryparam cfsqltype="cf_sql_char" maxlength="1" | value="#ARGUMENTS["visual" & i]#" |
Copy link to clipboard
Copied
You are attempting to use the arguments scope without passing any arguments to the function.
Copy link to clipboard
Copied
Arguments will be passed from elsewhere and will replace the values sent from the current FORM.
I want to make sure I'm on the right track before I start disassembling the code to move it to arguments