/    Sign up×
Community /Pin to ProfileBookmark

How can I reverse the effects of mysql_real_escape_string?

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?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@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.
Copy linkTweet thisAlerts:
@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].
Copy linkTweet thisAlerts:
@narutodude000authorJul 15.2010 — Thanks, the stripslashes worked.
×

Success!

Help @narutodude000 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...