简体   繁体   English

将textarea数据作为文本插入MySQL并输出结果

[英]Inserting textarea data into mySQL as text and output results

All, I'm inserting some text from a textarea in a mySQL database. 全部,我要从mySQL数据库中的textarea插入一些文本。 I'm using mysql_real_escape_string() to do this. 我正在使用mysql_real_escape_string()来做到这一点。 I'm using stripslashes() to remove the "\\" that gets inserted in front of this to display it. 我正在使用stripslashes()删除插入在其前面的“ \\”以显示它。 However when I output this it gives me the following result for something like wasn't I get wasn\\\\'t and if someone hits enter in my text area I get \\r\\n\\r\\n and that is also displayed. 但是,当我输出此内容时,它会为我提供以下结果,例如不是我得到了不是\\ n,如果有人在我的文本区域中输入了回车,我会得到\\ r \\ n \\ r \\ n并显示出来。

In my database it stores correctly with a single slash and the return but it doesn't output that the same way when it's outputed. 在我的数据库中,它以一个斜杠和返回值正确存储,但是输出时的输出方式不同。 Any idea why it would be doing this? 知道为什么会这样做吗?

Thanks 谢谢

As long as you are double checking how your outputting data. 只要您仔细检查输出数据的方式即可。 I used.. serialize(), and unserialize(). 我用.. serialize()和unserialize()。 Takes care of any special characters it seems. 照顾似乎所有特殊字符。 Have you tried that? 你尝试过吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM