做了个电子表单,填完提交,数据就被保存到PhpMyAdmin中,不过遇到一个syntax error.我发现如果我在文本框中输入的数据中包含" ' ", mysql就不能识别,数据无法提交.
比如: 我输入 "Pred's OneCert" 提交后就会出现 Could not query: You have an error in your SQL syntax,; check the manual that correspond to your MySQL server version for the right syntax to use near 's OneCert' 如果输入"Preds OneCert",提交就没有问题大家看看这个该怎么解决,. 谢谢了
比如: 我输入 "Pred's OneCert" 提交后就会出现 Could not query: You have an error in your SQL syntax,; check the manual that correspond to your MySQL server version for the right syntax to use near 's OneCert' 如果输入"Preds OneCert",提交就没有问题大家看看这个该怎么解决,. 谢谢了
{
return mysql_escape_string(stripslashes($str));
}字符型表单数据。经次函数过滤转义。