When you use mysql_real_escape_string to escape characters before inserting a string in a MySQL database, to avoid MySQL injection, for example or to be able to insert text like “dog’s bone”, ideally, the string inserted would not have the escape character \. The text would look like “dog’s bone” and not “dog\’s bone.
However, depending on your Linux installation, you may have this undesirable behavior. Why? Because the directive magic_quotes_gpc is set to On in your php.ini file.
So set it to Off and restart Apache.