0

I am trying to insert query with single qoute '.its break my query . e.g

INSERT INTO news (`Id`, `UserId`, `description`) VALUES (1,12,'Hello this descriptrion  and this single qoute ' in sentance');

It dose not insert and give error. so my question is whenever user enter description with single qoute e.g it's very hot today. how can i handle ' single quote in this way ?

You Answer highly Appreciate

Hashaam zahid
  • 315
  • 5
  • 21
  • 2
    From PHP you would use a prepared statement, then this will simply not be an issue: http://php.net/manual/en/mysqli.quickstart.prepared-statements.php – Alex K. Mar 20 '18 at 13:25

1 Answers1

1

you can do something like that :

  INSERT INTO news (`Id`, `UserId`, `description`) VALUES (1,12,"Hello this descriptrion  and this single qoute ' in sentance");
Jenish
  • 535
  • 4
  • 16