Andy Jarrett // Code. Develop. Manage.

PreserveSingleQuote Gotcha

After scratching my head for a while wondering why the below code;#preservesinglequotes(myArray[1])#was returning the error. Invalid CFML construct found on line 8 at column 26.
ColdFusion was looking at the following text:
[
I was sure that the array held a query then have just found out that preserveSingleQuotes only excepts simple values. So the above code should look more like#preservesinglequotes(sqlQry)#You would think that surely this could be error trapped by the CF server to inform you that you can only pass in simple values?
I’m here, learning and working away. If you liked this content and want to keep me going, consider buying me a coffee.
Your support keeps this site running and the coffee brewing! ☕️