Insert a value containing single quotes in MySQL

14,585

You need to use \ (Escape) character to insert single quotes and double quotes.

INSERT INTO table_name(`clomn1`) VALUES ('Ali said, "This is Ashok\'s Pen."')
Share:
14,585
Abrar Ahmed
Author by

Abrar Ahmed

Updated on July 27, 2022

Comments

  • Abrar Ahmed
    Abrar Ahmed almost 2 years

    How do I insert a value in MySQL that consist of single or double quotes. i.e

    Ali said, "This is Ashok's Pen." 
    

    The single quote will create problems. There might be other escape characters.

    I am using php to enter data into the database?

    How do you insert the data properly?