I am redesigning a new website and my database table need tidying up a bit.
In the mysql table, I have a data look like this for example:
text text text text - he\'s text text text he\'s text text
text couldn\'t text text.<br /><br />\"I\'m text text
text text. We\'re text <br /><br />text text
I need to remove all the slashes () and remove all the
. What the best way doing this?
From now on I will use mysql_real_escape_string() when adding data. To view use
nl2br()
Ensure that magic_quotes_gpc is off, it’s good practice. You can always use parse your database and reinsert it all.
str_replace is right but don’t use it if the data has been escaped, use stripslashes on the data.
Outputs:
Then re-insert it.