Vidyalelo
MySQL · Q782

MySQL

Programming · MySQL · question 782

Q782

How many of the following is considered as a special character by 'mysql_real_escape_string()'? null byte, single quote, backslash

A.
0
B.
1
C.
2
D.
3
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
This question asks about special characters that are handled by the `mysql_real_escape_string()` function in MySQL. This function is important because it helps prevent SQL injection attacks by escaping certain characters that could be interpreted as commands by the database.

Let's break down the options:
null byte: This is considered a special character and is escaped by `mysql_real_escape_string()`.
single quote: This is also a special character and needs to be escaped to avoid conflicts with SQL syntax.
backslash: The backslash itself is escaped by `mysql_real_escape_string()`, making it a special character.

Therefore, the answer is Option D: 3. All three characters listed are considered special characters by the function.