javascriptmysqltable-plus

error while inserting multiple inputs in sql


This is the query I used const dbQuery = INSERT INTO tasks (activity,type,participants,price,link,key,accessibility) VALUES ('${activity}','${type}','${participants}','${price}','${link}','${key}','${accessibility}');

This is the error I receive: "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 'key,accessibility) VALUES ('Repaint a room in your house','recreational','1','0.' at line 1"

The value for key received is like "4877086"

I think it is a datatype problem in sql, so tried using bigint, varchar and int but still got the same error. Also tried to convert the key to a number. If i remove the key from the syntax I receive the result perfectly.(Using Tableplus for MySql)


Solution