phpmysqlmagic-quotesmagic-quotes-gpc

Fixing magic_quote affected data


I've got a CMS to fix some issues. Since the hosting service has enabled php_magic_quotes in the server their database contains content with slashes. Once I got the project I requested the hosting party to switch off the magic_quotes and the issues isn't available anymore. However I need to fix existing affected data because of magic quotes. Is there any mysql or php command where I can use to fix these. Some records badly affected. As an example I can see something like this in the database you\\\\\\'r Appreciate any suggestion to fix these existing data.


Solution

  • Just use stripslashes to unescape your data:

    var_dump(stripslashes("you\\\\\\'r")); // string(6) "you\'r"