如何在MYSQL查询中转义引号? [英] How to escape quotes in a MYSQL query?
本文介绍了如何在MYSQL查询中转义引号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例子:follwing查询在字段中给我Quotes错误 - > GET ['email']
$ b
mysql_query( select * from user_info where user_mail ='$ _GET ['email']')
解决方案
$ _ GET ['email'] = mysql_real_escape_string( $ _GET [ '邮件']);
然后:
mysql_query(select * from user_info where user_mail ='。$ _GET ['email']。');
点将字符串放在一起。
Example: The follwing query give me Quotes error in the field -> GET['email']
mysql_query(" select * from user_info where user_mail = '$_GET['email']' ")
解决方案
You might want to escape the string first:
$_GET['email'] = mysql_real_escape_string($_GET['email']);
And then:
mysql_query(" select * from user_info where user_mail = '" . $_GET['email'] . "' ");
The dots put the strings together.
这篇关于如何在MYSQL查询中转义引号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文