如何在MySQL中存储包含引号的数据 [英] How to store data which contains quotes in MySQL

查看:65
本文介绍了如何在MySQL中存储包含引号的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的一种表单中,我使用了Yahoo!的RTF编辑器. 现在,我想将来自该文本区域的数据存储在MySQL数据库中.

In one of my forms I use the rich text editor from Yahoo!. Now i want to store the data from that textarea in a MySQL database.

用户可以在该文本区域中输入任何内容,例如许多双引号或单引号.

The user can enter anything in that textarea, e.g. many double or single quotes.

如何存储这些数据?

通常我们通过将数据添加到一个变量中进行存储,然后将其放入sql中,但是引号会引起问题.

Normally we store by adding that data in one variable and then put that in sql, but the quotes cause problems.

推荐答案

您使用 PDO准备好的语句(或 mysql_real_escape_string )

这篇关于如何在MySQL中存储包含引号的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆