为什么myaql执行出错You have an error in your SQL syntax,请大家帮助一下。

molika 发布于 2018/07/08 10:33
阅读 14K+
收藏 2

mysql为什么在一行里执行多条语句时总是出错?是要特殊设置吗?请问大家有没有解决办法?

MySQL Query:select * from my_news where id = 335; UPDATE my_member SET amount=1000 WHERE id=1020;#

MySQL Error: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 'UPDATE my_member SET amount=1000 WHERE id=1020;#' at line 1
MySQL Errno:1064
Message:MySQL Query Error

加载中
0
me坤子
me坤子
是不是多了个井号?
0
m
molika

去掉#的效果还是一样:

MySQL Query:select * from my_news where id = 1; UPDATE my_member SET amount=1000 WHERE id=1020;
MySQL Error: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 'UPDATE my_member SET amount=1000 WHERE id=1020' at line 1
MySQL Errno:1064
Message:MySQL Query Error

0
m
molika

如果只执行第一句就是正确的,如果后面的Update这一句放到一行来执行就会出错。


 

0
David_Dai_11
David_Dai_11
value加单引号试一下
0
m
molika

单引号会被转意为\'

 

0
m
molika

MySQL Query:select * from my_news where id = 335\'
MySQL Error: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
MySQL Errno:1064
Message:MySQL Query Error

0
s
stormh

如果用程序执行,要拆分开两条通过batch的运行。

如果是工具换个工具试试,

0
m
molika

是在get的sql注入环境中测试。

返回顶部
顶部