I want to write an SQL query that contains a NodeJS variable. When I do this, it gives me an error of 'undefined'.
I want the SQL query below to recognize the flightNo
variable. How can a NodeJS variable be input into an SQL query? Does it need special characters around it like $
or ?
.
app.get("/arrivals/:flightNo?", cors(), function(req,res){
var flightNo = req.params.flightNo;
connection.query("SELECT * FROM arrivals WHERE flight = 'flightNo'", function(err, rows, fields) {
See Question&Answers more detail:os