Dave... I'm surprised. Wouldn't you think that CFQueryParam would be the better 
way?

Where stuff in (<cfqueryparam value="#form.stuff#" cfsqltype="appropriate type" 
list="yes" separator="," />)

Steve

-----Original Message-----
From: Dave Watts [mailto:dwa...@figleaf.com] 
Sent: Monday, August 19, 2013 9:42 AM
To: cf-talk
Subject: Re: Using IN() within a cfquery statement


> I have a select name="stuff" multiple in a form filled with results from a 
> query.
> I get the form field value: stuff=selection1,selection5,selection12.
>
> How do I then build a cfquery using the stuff variable in the IN() statement?

Use the quotedValueList function to wrap single quotes around them.

SELECT ...
FROM ...
WHERE STUFF IN (#quotedValueList(form.stuff)#)

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:356485
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to