Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove \' after mysql_real_escape_string

Status
Not open for further replies.

bitwise

Programmer
Mar 15, 2001
269
US
Quick question, after I insert a block of text into my database after running it through "mysql_real_escape_string" it contains \' and \". Now, when I display the text back on a page somewhere it also contains those "\" slash characters. How should I deal with this? I do not want to do:

str_replace("\\", "", text)

Because I don't want to remove legitmate \ slash characters if someone actually wanted one.
 
it should not do. i suspect that you may have magic quotes gpc or runtime switched on. check there first.
 
Thank you. Just migrating to a new server and "magic_quotes_gpc" was ON so that did it. I was unaware of that setting. Ah, the joys of migrating.
 
it is a deep and dark evil. luckily turned off by default nowadays.

stripslashes() should fix the current boo-boos, assuming you are using a western-type character set.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top