> Even if you think CF will protect you from SQL injection attacks without
> needing to use <cfqueryparam>, there's one good reason for using it:
> lists.
>
> ...
>
> Now imagine if the list was a bunch of strings, say email addresses.
> Now that's even more annoying because you have to loop over all the
> different elements and output them into the query one by one. Or, if
> you're smart ...
I'm a big fan of CFQUERYPARAM, but this is a bad example to justify its use.
You don't need to do all that work. There's a function called ListQualify
that takes care of this for you:
<cfquery name="categories" ...>
SELECT categoryId, title, description
FROM categories
WHERE categoryId IN
(#ListQualify(FORM.categoryList, "'")#)
</cfquery>
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195215
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54