Insert form data into mysql database table using node.js and express implicitly? -
i tried below code inserts explicitly alternative when want insert dynamically.
when tried query able insert table
var post = {id:'20', name: 'cool', password:'****'}; var = con.query('insert fuck set ?', post, function(err, result) { if (err) throw err; else res.send('success'); });
but when directly inserting form values table table not getting updated
app.post('/getdata',function(req, res, next){ var txtname = req.body.name; var ager = req.body.age; var pwdd = req.body.pd; var post = {id:ager, name: txtname, password:pwdd }; var = con.query('insert fuck set ?', post, function(err, result) { if (err) throw err; else res.send('success'); });
Comments
Post a Comment