Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Struggling with array notation when converting to cfqueryparam

Community Beginner ,
Dec 12, 2012 Dec 12, 2012

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]#"
537
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 12, 2012 Dec 12, 2012

You are attempting to use the arguments scope without passing any arguments to the function.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 12, 2012 Dec 12, 2012
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources