'{"queue":[],"recieved":[],"accepted":[]}' not a valid query

Viewed 53

I'm receiving this error when trying to query a INSERT INTO request.

Table query:

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 query: INSERT INTO profiles (userid, balance, respects, tarowomaru, taruwumaru, suggestions, friends, flags)VALUES (323470201016549378, 0, 0, 0, 0, 0, '{"queue":[],"recieved":[],"accepted":[]}', '[]')

Received error: 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

Is there something wrong with {"queue":[],"recieved":[],"accepted":[]} or is there something wrong with my query? Is using get requests messing up the string?

1 Answers

I guess it was my query. My query before was

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

so it wasn't sending {"queue":[],"recieved":[],"accepted":[]} as a string.

The fixed query:

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

Thanks for you guy's help though!

Related