SQL报错,You have an error in your SQL syntax; check the manual that corresponds to
程序员文章站
2024-01-28 16:49:46
...
SQL报错了,
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1---Resource id #9----SELECT imei from messagelog where mac in ()
PHP代码:
不知道哪个地方有问题,求大神帮忙
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1---Resource id #9----SELECT imei from messagelog where mac in ()
PHP代码:
$mac.="'".$value."',";$listimei = $db->query("SELECT imei from messagelog where mac in ($mac) ")->fetchList();
不知道哪个地方有问题,求大神帮忙
回复讨论(解决方案)
试试
$listimei = $db->query("SELECT imei from messagelog where mac in ('$value') ")->fetchList();
你的 $mac 为空
实际执行的是 SELECT imei from messagelog where mac in ( )
这就要出错了:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')'
$mac最后多一个逗号
上一篇: Sun开始关闭MySQL部分功能的源代码_MySQL
下一篇: 【前端】CSS盒子模型和JS
推荐阅读
-
SQL报错,You have an error in your SQL syntax; check the manual that corresponds to
-
php异常:You have an error in your SQL syntax; 急
-
pymysql.err.ProgrammingError: (1064, “You have an error in your SQL syntax; check the manual that co
-
mybatis java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax;
-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
-
MySql-You have an error in your SQL syntax; check the manual that corresponds to your MySQL server v
-
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server
-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version