Page 1 of 1

MySQL translating html tags

Posted: Wed May 04, 2011 1:52 pm
by atrichtch
Hi all,

I have a common problem of trying to store HTML code in a MySQL database. Whenever I try to enter something that contains a special HTML character, like "<p>", it translates it into expressions like "<p>", which I don't want. What is the best way to avoid that?
Thanks.

Re: MySQL translating html tags

Posted: Wed May 04, 2011 2:27 pm
by McInfo
Look for usage of the functions htmlspecialchars() or htmlentities() in your code.

Re: MySQL translating html tags

Posted: Wed May 04, 2011 3:27 pm
by atrichtch
I didn't use any of those. I only used mysql_real_escape_string to add backslashes, but they didn't affect angle brackets.