How to escape single quotes in MySQL
问题 How do I insert a value in MySQL that consist of single or double quotes. i.e This is Ashok\'s Pen. The single quote will create problems. There might be other escape characters. How do you insert the data properly? 回答1: Put quite simply: SELECT 'This is Ashok''s Pen.'; So inside the string, replace each single quote with two of them. Or: SELECT 'This is Ashok\'s Pen.' Escape it =) 回答2: See my answer to "How to escape characters in MySQL" Whatever library you are using to talk to MySQL will