开发者

How to store html characters in mysql and display them correctly

开发者 https://www.devze.com 2023-04-10 15:47 出处:网络
Not sure if I am asking this correctly.But I am using a Jquery HTML Editor cl开发者_运维技巧editor so that the users can load html text.When I insert this into my db(mysql) and want to display the out

Not sure if I am asking this correctly. But I am using a Jquery HTML Editor cl开发者_运维技巧editor so that the users can load html text. When I insert this into my db(mysql) and want to display the outcome it takes out any html characters it had like: <p>, <span>, and so on. So when I go view it, it shows like this:

class=\"noticia_texto\">jlasdfklsfklaf

which obviously it's not readable. Help please? Should I be using anything at the time of inserting or displaying or both? Also my datatype is set to Blob.


MySQL does NOT strip html tags. If they're being removed upon insertion (or retrieval), then it's something in your code doing it, not MySQL.

Given that the quotes in your snippet are escaped, you've almost certainly got magic_quotes enabled, and/or a home-brew SQL escaping function run amok.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号