I have a form where the users use TinyMCE to fill out some information, and that form is then POSTed, and stored in a database.
The problem appears to be that mysqli::real_escape_string is turning carriage return line feeds into escaped versions of themselves, and storing them. Well... that is part of the design. But when I re-read the database, and run stripslashes() on the data as it is read from the DB, I get output like this:
Here si some good HTML code
rn
But you can see
rn
that there are annoying
rn
"rn" on blank lines between everything.
How can I store HTML in the DB, and retrieve it without having this \r\n problem?
It is just as safe (in my opinion, safer) than mysql_real_escape_string()
http://us1.php.net/manual/en/function.htmlentities.php is the function documentation.
http://www.ascii.cl/htmlcodes.htm shows you the HTML codes.
The only drawback is that it will take 4-5 bytes in your database to store each special character.