Re: Sanitizing mysql inserts of user data

From: Date: Mon, 17 Aug 2009 17:52:14 +0000
Subject: Re: Sanitizing mysql inserts of user data
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-296891@lists.php.net to get a copy of this message
> "Note: If this function is not used to escape data, the query is > vulnerable to SQL Injection Attacks." > > Does that necessarily imply this: > "If this function is used to escape data, the query is not vulnerable > to SQL Injection Attacks."? > > Logically, it does _not_ mean the same thing. Definitely not -- it would be a bit presumptuous to claim "If you do X, the query is not vulnerable to SQL injection attacks" for just about any value of X. That said, I would recommend binding parameters if you can. It's a cleaner way of separating the logic of a query from its data, and theoretically more reliable than mysql_real_escape_string(): http://en.wikipedia.org/wiki/SQL_injection#Parameterized_statements Ben

« previous php.general (#296891) next »