+1
Besvaret

escaping single quotes

Michael Mikkelsen 12 år siden opdateret af icahill (Administrator) 12 år siden 2
How do I escape the single quotes out of a text string so that I can put it into a SQL Database?
I added this function to functions.html. It works to escape the single quotes but I still have a problem if there are any double quotes in the string.


function dbText(str)
{
str = str.replaceAll("'", "&#39");
return str;
}
This is the nature of XML, it does require XML encoding.

For double quotes you would have to use "

Kundesupport af UserEcho