0

As far as I know we can't enter ', ", \ to a database(to a varchar field). We need special methods like ''', '"', \\ to enter them into a database.

any other symbols than that?

I'm using MYSQL!

Barmar
  • 741,623
  • 53
  • 500
  • 612
sajithneyo
  • 641
  • 3
  • 7
  • 17
  • 1
    There are no such restrictions on characters in a `varchar()` field. If you're entering them as literals into the SQL statement then you'll need to escape some characters. But if you're using MYSQLI you should use prepared statements, so it's not a problem. – Barmar Aug 27 '16 at 06:13
  • If you're not using a prepared statement, use `mysqli_real_escape_string()` and it will escape any special characters. You don't need to concern yourself with which characters are special. – Barmar Aug 27 '16 at 06:15
  • 1
    If you're not using a prepared statement, you probably need your head examined – Strawberry Aug 27 '16 at 07:04

1 Answers1

0

Special Character Escape Sequences are listed below-
\0 - ASCI NUL(X '00')
\' - Single quote (“'”)
\" - Double quote (“"”)
\b - Backspace
\n - Newline (linefeed)
\r - Carriage return
\t - Tab
\Z - ASCII 26 (Control-Z)
\ - Backslash (“\”)
\% - “%”
\_ - “_”

You can see Table 10.1 and examples to get more information on MySql's String Literal's page.

Also check this question.

Community
  • 1
  • 1
user2940296
  • 143
  • 15