I am new in Node and trying to develop some initial apps. I am currently inserting record into database(MySQL) through Node. My post method is like
router.post('/add',function(req,res){
connection.connect();
var firstName = req.body.FirstName;
var lastName = req.body.LastName;
students.push({
//id: studentList.length+1,
FirstName: firstName,
LastName: lastName
});
var post = {FirstName: firstName, LastName: lastName};
connection.query('INSERT INTO tblstudent VALUES ? ', post,function(err,result){
if (err) {
res.send("There was a problem adding the information to the database.");
}
});
res.redirect('/');
connection.end();
});
where Id is another column but auto incremented, so I trying to insert record. I'm having the following error.