PHP: Avoiding mySQL Injections
Wednesday, 30 April 2008
Sample code to avoid SQL injections using mysql_real_escape_string (http://uk.php.net/mysql_real_escape_string) which converts special characters to escape sequences to ensure they are suitable for submission to SQL
$mySQL = "UPDATE address SET postcode='.mysql_real_escape_string($postcode).' WHERE id='.mysql_real_escape_string ($account).'";
$myResult = mysql_query($mySQL);

Jason Slater is an independent technologist and blogger.
[...] would also be useful to use the mysql_real_escape_string in this instance to avoid SQL Injections. addthis_url = [...]