the double quotes? like '%bob%' or '%ted%' On Wed, May 4, 2011 at 7:04 PM, Les Mizzell <[email protected]> wrote: > > Below is for a search interface I'm working on. > > A single word into the query works fine. > > I've a function that cleans the input, removes common words, and builds > a list. The list is getting built properly. > > > If I input "bob,ted" I get an vague syntax error (shared hosting - robut > reporting is off). If I output the query to see what's being generated I > get: > > WHERE section <> 'news' > AND ( headline LIKE "%bob%" or content LIKE "%bob%" ) > AND ( headline LIKE "%ted%" or content LIKE "%ted%" ) > > Been awake too long. What's wrong with the below? > > SELECT > id_page, > headline, > content, > section > FROM pages > WHERE section <> 'news' > <cfif ListLen('#myLIST#') gt 1> > AND > <cfloop list="#mylist#" index="i"> > <cfset #thisROW# = #thisROW# + 1 /> > ( headline LIKE <cfqueryparam value="%#i#%" > cfsqltype="cf_sql_varchar"> > OR content LIKE <cfqueryparam value="%#i#%" > cfsqltype="cf_sql_varchar"> ) > <cfif #thisROW# LT #listCOUNT#> AND </cfif> > </cfloop> > <cfelse> > AND ( headline LIKE <cfqueryparam value="%#req.cleanerINPUT#%" > cfsqltype="cf_sql_varchar"> > OR content LIKE <cfqueryparam value="%#req.cleanerINPUT#%" > cfsqltype="cf_sql_varchar"> ) > </cfif> > >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:344240 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

