“{”queue“:[],”received“:[],”accepted“:[]}”不是有效的查询

iaqfqrcu  于 2021-07-29  发布在  Java
关注(0)|答案(1)|浏览(340)

这个问题在这里已经有答案了

如何在mysql语句中包含php变量(6个答案)
9个月前关门了。
我在尝试查询 INSERT INTO 请求。
表查询:

CREATE TABLE `profiles` (
  `userid` bigint(20) NOT NULL,
  `balance` bigint(20) NOT NULL,
  `respects` bigint(20) NOT NULL,
  `tarowomaru` bigint(20) NOT NULL,
  `taruwumaru` bigint(20) NOT NULL,
  `suggestions` bigint(20) NOT NULL,
  `friends` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  `flags` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

sql查询: INSERT INTO profiles (userid, balance, respects, tarowomaru, taruwumaru, suggestions, friends, flags)VALUES (323470201016549378, 0, 0, 0, 0, 0, '{"queue":[],"recieved":[],"accepted":[]}', '[]') 收到的错误: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"queue":[],"recieved":[],"accepted":[]},[])' at line 17 有什么问题吗 {"queue":[],"recieved":[],"accepted":[]} 还是我的问题出了问题?使用get请求是否会弄乱字符串?

4xy9mtcn

4xy9mtcn1#

我想是我的问题。我之前的问题是

"INSERT INTO profiles (userid, balance, respects, tarowomaru, taruwumaru, suggestions, friends, flags) VALUES ($userid, $balance, $respects, $tarowomaru, $taruwumaru, $suggestions, $friends, $flags)"

所以它没有发送 {"queue":[],"recieved":[],"accepted":[]} 作为一根弦。
固定查询:

"INSERT INTO profiles (userid, balance, respects, tarowomaru, taruwumaru, suggestions, friends, flags) VALUES ($userid, $balance, $respects, $tarowomaru, $taruwumaru, $suggestions, '$friends', '$flags')"

谢谢你们的帮助!

相关问题