- would I need to use real escape in both my INSERT and SELECT FROM statements?
-
why the syntax I’m using in the following example isn’t working (It’s just one of the many ways I’ve tried)?
//insert user input for word 1 $sql = "INSERT INTO test (Word1, Word2, Word3, Word4, Word5) VALUES('$Word1','$Word2','$Word3','$Word4','$Word5')", mysql_real_escape_string($Word1), mysql_real_escape_string($Word2), mysql_real_escape_string($Word3), mysql_real_escape_string($Word4), mysql_real_escape_string($Word5); if(!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }
would I need to use real escape in both my INSERT and SELECT FROM
Share
I highly recommend that you avoid escaping altogether, and move directly to prepared statements with mysqli::prepare, perhaps via PDO. It’s ultimately simpler and safer: