T
T
Torento203452021-07-20 13:20:01
PostgreSQL
Torento20345, 2021-07-20 13:20:01

Why doesn't the INSERT query through ${} work?

When trying to query
var query = `INSERT INTO users (name, phone) VALUES (${data.name}, ${data.phone})`;
Gives an error that the data.name column does not exist (i.e., the column "Boris", "Ivan" does not exist).
How to make a request?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vreitech, 2021-07-20
@fzfx

var query = `INSERT INTO users ("name", "phone") VALUES (${data.name}, ${data.phone})`;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question