Do you not have access to a SQL editor you could put that outputted SQL into?
Should point out where the syntax issue is..

Do this
<cfoutput>
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 '%#i#%'
                or content LIKE '%#i#%'
                <cfif thisROW LT listCOUNT> OR </cfif>
        </cfloop>
        )
        <cfelse>
        AND ( headline LIKE '%#req.cleanerINPUT#%'
        or content LIKE '%#req.cleanerINPUT#%' )
</cfif>
</cfoutput>

Then take what's outputted exactly and put it in the SQL editor and
see what error the SQL editor points out and where.



On Wed, May 4, 2011 at 8:46 PM, Les Mizzell <[email protected]> wrote:
>
> On 5/4/2011 9:11 PM, Greg Morphis wrote:
>>
>> Take your query and wrap it in a cfoutput tag instead of cfquery.
>> Remove the cfqueryparams and just have the variables.
>
> That's this:
>
> WHERE section <> 'news'
> AND ( headline LIKE '%bob%'
> or content LIKE '%bob%' OR headline LIKE '%robert%'
> or content LIKE '%robert%' )
>
>
> ...or,when entering only one variable (and this is working)
>
> WHERE section <> 'news'
> AND ( headline LIKE '%bob%'
> or content LIKE '%bob%' )
>
>
>
>
> Query is:
>
>  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#> OR </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:344246
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to