Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8464517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:46:11+00:00 2026-06-10T14:46:11+00:00

I am having trouble with a problem. I am using cfoutput to run the

  • 0

I am having trouble with a problem. I am using cfoutput to run the results of a query inside a form. There are a few cfselects that are dynamically named, i.e. entry_1, entry_2, etc. These are then passed to an actionpage alonge with the record count in the url, where I want to insert them into a database with a cfloop.

<cfloop from="1" to="#url.Count#" index="i">  
<cfquery name="id_#i#" datasource="xxx">Insert Into table1(entry_level) Values(#form.entry_#i##)</cfquery>  
</cfloop>  

And it’s tossing an error everytime. I’ve tried using array format, but I still can’t get it to work. Please help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:46:13+00:00Added an answer on June 10, 2026 at 2:46 pm

    You can’t construct a dynamic struct selector that way. You can do something like the following to get the same result.

    So, using the following data:

    <cfset url.count = 3>
    <cfset form.entry_1 = 1>
    <cfset form.entry_2 = 2>
    <cfset form.entry_3 = 3>
    

    Something like this would work –

    <cfloop from="1" to="#url.Count#" index="i">  
      <cfquery name="id_#i#" datasource="xxx">
        Insert Into table1(entry_level) Values(#form['entry_' & i]#)
      </cfquery>  
    </cfloop>  
    

    ColdFusion basically gives you two ways to access a value of a structure, either via a . notation or via brackets. If you are trying to access a structure via a dynamic key, you have to use brackets.

    By the way, slightly better would be:

       <cfloop from="1" to="#url.Count#" index="i">  
          <cfquery name="id_#i#" datasource="xxx">
            Insert Into table1(entry_level) Values(<cfqueryparam value="#form['entry_' & i]#">)
          </cfquery>  
        </cfloop>  
    

    cfQueryParam automatically escapes the entry so that you don’t have to worry about SQL injection attacks. It can also make the query slightly more efficient.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble creating multiple xml requests using php's curl_multi_exec. The problem is that
So Im having trouble with a problem. Im givin that a is an array
My problem is that I'm having trouble specifying paths for Lua to look in.
Problem I'm having trouble using XdcMake to generate XML documentation in a C++ project
I'm having trouble using contentEditable in FireFox 3. I have a problem where the
My problem is similar to this one: I'm having trouble using paramaters in a
Problem: I am having trouble generating an xpath expression that selects a node in
I am having trouble identifying a problem on Android TimerTask (I believe) that is
I am using the MHRotaryKnob Class and having trouble configuring it so that multiple
I am having trouble using rsh in the PHP exec() command. The error that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.