MySQL Real Escape String

Like this blog? Consider exploring one of our sponsored banner ads...

I always escape MySQL statement parameters from PHP using the function mysql_real_escape_string(), even after I have groomed them. One thing that I always forget is that this function will not work if you have not established a database connection. Without a database connection it returns nothing. If you have error reporting turned on, you will get a database connection error on the line that you are calling the mysql_real_escape_string() function.


About this entry