Greetings... I've been looking around for information on preventing sql injection attacks, and ran into a question... I am using the mysql_real_escape_string() function on a SQL insertion (for when a user submits a comment). The problem is, when I retrieve the data out of the sql database, all of the special characters are still prepended.
I was looking for the "reverse" of mysql_real_escape_string(), and I read somewhere that I can just use strip slashes or string replace. But, then someone else said you should never need a reverse function as all data the comes out of the database should be fine anyways...
I can see how the data would be fine for a select query, but for an insert, it seems to be a different story. What is the best way of going about this??
Thanks in advance for the advice.