Avoid SQL Injection With A Few Lines in PHP

I have seen a great usage about avoiding SQL injection in PHP. Method uses an array function to modify all $_GET or $_POST arrays.

$_GET = array_map('mysql_real_escape_string',$_GET);
$_POST = array_map('mysql_real_escape_string',$_POST); 

array_map() function applies another function you want to all array items.

I hope it helps!

Add a Comment

Your email address will not be published. Required fields are marked *