Michael Casey
unread,Feb 10, 2017, 5:34:32 AM2/10/17You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I am using ColdFusion 11 and a MySQL5 database, with everything set to UTF-8 character encoding. I am having trouble making my selects work properly when they contain single quotes. Here is a simple example:
I have a simple piece of sql:
select * from table where column = 'I've got a single quote';
In my sql client I need to modify this to escape the single quote, thus:
select * from table where column = 'I''ve got a single quote';
And this works correctly.
And in ColdFusion, the query looks like this:
<cfquery name="qryName" datasource="dsn">
select * from table where column = <cfqueryparam CFSQLType="CF_SQL_VARCHAR" value="I've got a single quote" />
</cfquery>
However, the row is not returned and there is no error.
I tried using preserveSingleQuotes too, but still nothing is returned:
<cfqueryparam CFSQLType="CF_SQL_VARCHAR" value="#preserveSingleQuotes(I've got a single quote)#" />
Can anyone suggest what's wrong?