This is the code I am writing:
db.query('INSERT INTO product (title, img_url, desc, price) VALUES (?, ?, ?, ?)',
[this.title, this.img_url, this.desc, this.price]);
And this is the error I am getting
code: 'ER_PARSE_ERROR',
errno: 1064,
sql: "INSERT INTO product (title, img_url, desc, price) VALUES ('sdfsdf', 'fsadfds', 'fgdsfg', 100)",
sqlState: '42000',
sqlMessage: "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 'desc, price) VALUES ('sdfsdf', 'fsadfds', 'fgdsfg', 100)' at line 1"
I am using mysql2 package.
Datatype:
title = VARCAR(255)
img_url = VARCAR(255)
desc = TEXT
price - INT