How can we escape special characters in MySQL statement?

MySQLMySQLi Database

Sometimes we need to include special characters in a character string and at that time they must be escaped or protected. We need to pursue some basic rules for escaping special characters which are given below −

The escape character (\) can be escaped as (\)

Example

mysql> Select 'A\B';
+-----+
| A\B |
+-----+
| A\B |
+-----+
1 row in set (0.00 sec)
raja
Updated on 22-Jun-2020 12:24:08

Advertisements