Here is my high-level view on this topic.
When using dynamic SQL strings, you rely on an evacuation function that works correctly. Unfortunately, this is not always the case, as can be seen in this (admittedly old) example:
http://dev.mysql.com/doc/refman/5.0/en/news-5-0-22.html
After your data values have been escaped, the SQL string must be parsed and compiled by the database server. If the escaping function did not do its job properly or a smart new SQL injection attack is detected, there is a chance that the server will mistakenly receive data for SQL statements.
If you use prepared statements with parameters, the statement is parsed and compiled first. Data values are combined with the compiled statement when it is executed. This separates SQL logic from data values — the possibility of confusion should never arise.
So, yes, you can do without mysqli_real_escape_string , but I would not say that using prepared statements with parameters makes SQL injection impossible. This makes it much more complicated, but, as with the mysqli_real_escape_string error, I believe that there is always the possibility that a detected (or newly created) error will seem impossible, perhaps.
Mike
source share