try along this line using list=yes in cfqueryparam

select * where id in (<cfqueryparam value="#form.field#" list="yes">)

~Terry 

-----Original Message-----
From: Bobby Schuchert [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 25, 2007 8:52
To: CF-Talk
Subject: Loop a query

I ran out of RedBull so I am slow this morning. 

I have a series on checkboxes in a form. I would like the user to pick
the checkboxes they want then hit a button to show those respective
items as labels on a display page. I am having trouble trying to get the
ids of these items to populate the table row by row. I need to be able
to loop an array or query on the display page.

Is it bad practice to run a query on each one of those items in the list
using a loop like so:

<cfloop index="i" list="form.checkboxfield"> <cfquery> Select field1,
field2, field3 from table where field1 = i </cfquery> </cfloop>

Won't that create a database connection for each item in the list? Is
there an alternative to use that is more efficient?

Thanks.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276206
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
  • RE: Loop a query Bader, Terrence C CTR MARMC, 231

Reply via email to