Answer the question
In order to leave comments, you need to log in
How to make a query in mysql?
module.exports = {
addAnnPage: (req, res) => {
res.render('add-ann.ejs', {
title: "Welcome | Add a new"
,message: ''
});
},
addAnn: (req, res) => {
let first_name = req.body.first_name;
let last_name = req.body.last_name;
let number = req.body.number;
let auto = req.body.auto;
let info = req.body.info;
let price = req.body.price;
let usernameQuery = "SELECT * FROM `ann` WHERE first_name = '" + first_name + "'";
db.query("INSERT INTO `ann` (first_name, last_name, number, info, price, auto) VALUES ('"+first_name + "', '" + last_name + "', '" + number + "', '" + info + "', '" + price + "', '" + auto + "')", function(err, info) {
console.log(info.insertId);
});
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question