There is only one thing about mysql_real_escape_string () and SQL Injection -
The former has nothing to do with the latter.
Although this sounds paradoxical, nothing could be more true.
Here are 2 statements confirming it
- You need to avoid quoted strings as this function helps nothing.
- In fact, you need to avoid every line that you add to the query, even the safest one. simply because it may contain some special character and thus break up the request (just like an accident, not a malicious plot).
Thus, when applicable, this function must be used in any case, despite all the dangers or concerns. And in any other case, nothing will help.
The only thing I have to add is that the prepared statements also do not provide complete protection. Here is an explanation and recommendations: stack overflow
Your common sense
source share