M
M
Mikhail Yarema2017-10-06 11:56:46
Node.js
Mikhail Yarema, 2017-10-06 11:56:46

How to add variable to MYSQL + express query?

Good afternoon!
Tell me please.
How to add a variable to a MYSQL query

var valProgrammNumber =          req.body.programmNumber;
var valFullName =                        req.body.fullName;
var valCompany =                         req.body.company;

connection.query('INSERT INTO umodoc (programmNumber, fullName, company) 
                             VALUES (valProgrammNumber, valFullName, valCompany)',
function(err, rows, fields) {
  console.log(err);
});
connection.end();
});

doesn't work like that.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2017-10-06
@frezebloom

connection.query('INSERT INTO umodoc (programmNumber, fullName, company) VALUES (?, ?, ?)', [valProgrammNumber, valFullName, valCompany]...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question