ai didi

php - 如何转义 MYSQL 查询中的引号?

转载 作者:太空宇宙 更新时间:2023-11-04 15:22:50 24 4
gpt4 key购买 nike

示例:以下查询在字段中给我引号错误 -> GET['email']

    mysql_query(" select * from user_info where user_mail = '$_GET['email']' ")

最佳答案

您可能想先对字符串进行转义:

$_GET['email'] = mysql_real_escape_string($_GET['email']);

然后:

mysql_query(" select * from user_info where user_mail = '" . $_GET['email'] . "' ");

点将字符串放在一起。

关于php - 如何转义 MYSQL 查询中的引号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6793632/

24 4 0
文章推荐: css - 禁用 CSS 时如何隐藏 div?
文章推荐: java - 无法使用 Xuggler 通过 RTMP 向 FMS 连续不间断地发布直播流
文章推荐: java - 如何通过java更改任务栏图像?
文章推荐: html - 如何防止连接波斯语字符?
太空宇宙
个人简介

我是一名优秀的程序员,十分优秀!

滴滴打车优惠券免费领取
滴滴打车优惠券
全站热门文章
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com