After retrieving data that went through mysql_real_escape_string before they were inserted into the database, I want to remove all of the slashes. I know I can do it using preg_replace, but is there a built-in PHP function that can do this for me?
@MindzaiJul 15.2010 — #The escaping is only for MySQL, it doesn't affect the data itself. Once you query the data from the database it should already be free from any escape characters. If it isn't then you might have magic_quotes enabled, the solution for which is to use stripslashes before mysql_real_escape_string.
@NogDogJul 15.2010 — #As Mindzai said, the escaping back-slashes should not be showing up in your data, unless you are double escaping for some reason, the most likely reason being that the now-deprecated magic_quotes_gpc feature is enabled (deprecated now because of this type of confusion/hassle that it causes). I've got a little function here you can use to easily undo its effects if it cannot be turned off.: [url=http://www.charles-reace.com/blog/2010/07/13/undoing-magic-quotes/]Undoing Magic Quotes[/url].