Hi everyone. I'm having some trouble with single quotes. I'm trying to build
a dynamic sql query. The code is below. The problem is occurring when I try
to put single quotes around the variable prop_id. Even when I do the
replace, when I place the var. inside the sql statement the single quotes
appear as double quotes and the query blows up. Any help is greatly
appreciated. Thanks very much.
Keith
<cfset county = "0">
<cfloop query="get_investigator">
<cfif county eq "0">
<cfset prop_next = "prop_id = |#get_investigator.prop_id#|">
<cfelse>
<cfset prop_next = "#prop_next# or prop_id = |#get_investigator.prop_id#|">
</cfif>
<cfset county = county + 1>
</cfloop>
<cfset prop_next = replace("#prop_next#", "|", "'", "all")>
<cfquery name="get_proposal" datasource="#datasource#">
select * from tbl_proposal_master
where
(#prop_next#)
and fice = #session.fice#
<cfif session.usertype eq "a">
and
(tbl_user.type = 'a' or (tbl_user.type = 'f' and
tbl_proposal_master.submitted = 1))
<cfelse>
and
created_by = '#session.username#'
</cfif>
order by prop_id
</cfquery>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists