MySQL特殊字符问题 [英] MySQL special characters problems
本文介绍了MySQL特殊字符问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我的 mySQL 查询和插入有问题.
Hello I have an issue with my mySQL queries and insertions.
当成员在文本区写下这些字符时,例如:
When members write in the text area these characters, like:
' " < >
还有其他一些..mySQL 会给出数据库错误.
and some others.. the mySQL will give a database error.
我能做些什么来避免这种情况?我认为这是 PHP 中的常态.
What I can do to avoid this? I think it is a usualthing in PHP.
谢谢
推荐答案
使用 mysql_real_escape_string() 尝试插入数据之前.
Use mysql_real_escape_string() on the data before you try to insert it.
这也将保护您免受SQL 注入.
这篇关于MySQL特殊字符问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文