0

So i have a data base and in the app while the user searches for something with the ' character, like "wendy's house", i send a query with the WHERE as "wendy's house" and here is where it crushes.

I would like to know please what should i do with the string in order that ill be able to send it in the query and the result the user gets will stay unharmed.

Thanks in advance.

Itay Feldman
  • 846
  • 10
  • 23

1 Answers1

1

Here you have an answer how to escape the apostrophe in your SQL:

INSERT INTO Person
    (First, Last)
VALUES
    ('Joe', 'O''Brien')
              /\
          right here  

Or

SELECT First, Last FROM Person WHERE Last = 'O''Brien'

https://stackoverflow.com/a/1912100/2065587

mmBs
  • 8,421
  • 6
  • 38
  • 46