When I write
input data: hel'l"lo
print_r($_POST) display hel\'\"lo
and when I use
if(get_magic_quotes_gpc()){
mysql_real_escape_string($_POST);
display
hel\\\'\\\"lo
Because PHP automatically adds slashes, is it necessary to use mysql_real_escape_string?
No, from version 5.3 onwards, there will be no slashes added by default. Also note that
addslashesis not a replacement formysql_real_escape_string; you can read more about that here.