Q:

Is there some code that I can use to filter through strings to put escape characters in front of invalid MySQL characters?

I'm building a comment section on my website and I need to be able to filter through strings and escape invalid characters?
Is there any code that can automate this and return a string with escape characters properly placed?
I use PHP btw.

A:

You want mysql_real_escape_string(), or bind your params with something like PDO.

