Ask a Question related to Macromedia ColdFusion, Design and Development.
-
forums.macromedia.com #1
convert string to safe string before adding to database
Hi
I am updating a site for a client who is running CF5. The update and insert
queries break when the user uses inverted commas ". I currently have a
script which does the following:
<cfscript>
content = ReplaceNoCase(attributes.content,"&##x93;","" ","ALL");
content = ReplaceNoCase(content,"“",""","ALL");
content = ReplaceNoCase(content,"‘","&##8216;","ALL");
content = ReplaceNoCase(content,"&##x94;",""","ALL");
content = ReplaceNoCase(content,"”",""","ALL");
content = ReplaceNoCase(content,"’","&##8216;","ALL");
content = ReplaceNoCase(content,"&##x91;","&##8216;","ALL");
content = ReplaceNoCase(content,"&##x92;","&##8216;","ALL");
content = ReplaceNoCase(content,"&##x96;","-","ALL");
content = ReplaceNoCase(content,"–","-","ALL");
content = ReplaceNoCase(content,""",""","ALL");
content = ReplaceNoCase(content,""",""","ALL");
content = ReplaceNoCase(content,"'","&##8217;","ALL");
content = ReplaceNoCase(content,"'","&##8217;","ALL");
content = ReplaceNoCase(content,"'","&##8217;","ALL");
content = ReplaceNoCase(content,"'","&##8217;","ALL");
content = ReplaceNoCase(content,"-","-","ALL");
content = ReplaceNoCase(content,"£","£","ALL");
content = ReplaceNoCase(content,"""",""","ALL");
caller.result = content;
</cfscript>
but the inverted commas are still breaking the script. The database is
access.
any help or advice appreciated!!
Shaun
forums.macromedia.com Guest
-
How to convert ByteArray to String?
We are using SQL Server, one of the columns is ByteArray datatype, when I tried to output it with the <cfoutput> tag, I got ' ByteArray objects... -
Convert String to Int then divide
Here is my code: <cfdirectory directory = "f:\testbed\documents\" name = "myDirectory" sort = "name ASC, size DESC"> <!--- Output the contents... -
How to convert string to float?
i want to covert a querystring to float number in asp. what function should i use? i know cint() can convert string to int but how about float? -
How to convert forma value to string
Subbu, Try... Format(!!) - Steve Schapel, Microsoft Access MVP On Tue, 22 Jul 2003 14:54:28 -0700, "subbu"... -
Convert string to HTML
Is there something in .NET that will convert a string so that it can be displayed correctly as HTML? eg I would like to convert the string "a <... -
vkunirs #2
Re: convert string to safe string before adding todatabase
Hi
can you try with PreserveSingleQuotes ?
will it works for your situation.?
can you post your final update query (The dynamic query generate by your program).
vkunirs Guest



Reply With Quote

