Basically sanitization is used for escaping special characters while inserting into database.
function mysql_real_escape_string (str) { return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) { switch (char) { case "\0": return "\\0"; case "\x08": return "\\b"; case "\x09": return "\\t"; case "\x1a": return "\\z"; case "\n": return "\\n"; case "\r": return "\\r"; case "\"": case "'": case "\\": case "%": return "\\"+char; // prepends a backslash to backslash, percent, // and double/single quotes } }); }
How to this function ?
var template = "<div> Hi Welcome to this example.</div>"; mysql_real_escape_string(template);
You might also like:
Example for Conditional Operator in php16-04-2017 php Conditional Operator example |
How to get id by using name attribute in javascript20-03-2017 html id name javascript |
How to convert html to pdf in Node js12-03-2017 pdf convert html node js |
How to find Angular Errors06-03-2017 errors angularjs exceptionHandler |
How to set or update or push the values into Object in javacript27-02-2017 javascript set update push object |