Is mysql_real_escape_string enough to Anti SQL Injection?

风格不统一 提交于 2019-11-27 15:13:40

mysql_real_escape_string is usually enough to avoid SQL injection. This does depend on it being bug free though, i.e. there's some small unknown chance it is vulnerable (but this hasn't manifested in the real world yet). A better alternative which completely rules out SQL injections on a conceptual level is prepared statements. Both methods entirely depend on your applying them correctly; i.e. neither will protect you if you simply mess it up anyway.

As far as i know this is a solid way to avoid SQL Injection attacks.

meagar

The best solution is PDO.

If you're using the traditional mysql_query then running all of your data through mysql_real_escape_string() is enough.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!