Copy link to clipboard
Copied
Can you please correct this query
<cfquery name="getView" datasource="#Application.DSN_GDX#">
select * from vstr_entity_mast_y where tax_year=2011
</cfquery>
<cfset checkedImgStr = "<img src=../stir_images/checked.jpg>">
<cfset loopStr = "">
<cfset variables.listIds = "BNSR,BNSS,VIEW">
<cfloop index="Fld" list="#variables.listIds#">
<cfset loopStr = loopStr&'<img src=../stir_images/checked.jpg>'& " as [#Fld#],">
</cfloop>
<cfset P_loopStr = replace(loopStr, "<img src=../stir_images/checked.jpg>", "'<img src=../stir_images/checked.jpg>'", "all")>
<cfquery name="getPrivByUser" dbtype="query">
select entity_id, entity_name,#P_loopStr# leid
from getView
</cfquery>
I am getting this error:
Encountered "<. Incorrect Select Statement, Expecting a 'FROM', but encountered '<' instead, A select statement should have a 'FROM' construct.
Copy link to clipboard
Copied
In view of the comma at the end of loopStr, I will assume that leid is a column name. Then the likely cause of the error is ColdFusion escaping the single quotes you added. To prevent this, modify the select statement to
select entity_id, entity_name,#preserveSingleQuotes(P_loopStr)# leid
Copy link to clipboard
Copied
output your variable and see what it ends up being. put it in a pre tag to make sure the angle bracket shows up.