Try to format your variable with bracket notation:

'#form["abil#i#"]#'

That usually works for me


Thanks,
Alan

On May 16, 2013, at 4:47 PM, Marcus F <[email protected]> wrote:

> Once more I turn to you old CFML gurus in hope to save my sanity.
> 
> I'm trying to figure out how to use a dynamic variable in a loop with a query.
> I have a form that submits 20 values, I need to collect info from a DB based 
> on the names of the values from the form.
> Nothing fancy so far, but I'd like to not have to write 800 lines of code 
> when I could just use a loop, or so I'd like to think anyway, and there's my 
> problem.
> 
> The form fields I need are named abil1 - abil20, so my query looks roughly 
> like this
> 
> <cfloop from="1" to="20" index="i">
>        SELECT cost FROM abilities WHERE name = '#form.abil1#'
> </cfloop>
> 
> I can't figure out how I can use the index to dynamically pull the form.abil 
> fields and run the query one by one.
> 
> There's no way I'm the first to run into this, but I've looked and can't find 
> a solution out there, I found some solutions for dynamic variables but 
> nothing that would help in this case.
> -- 
> -- 
> online documentation: http://openbd.org/manual/
> http://groups.google.com/group/openbd?hl=en
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Open BlueDragon" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
-- 
online documentation: http://openbd.org/manual/
 http://groups.google.com/group/openbd?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Open 
BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to