I have an app in which i take input from user via post and then insert those inputs in db. Insertion of integer is resulting in error. invalid input syntax for integer.Please help. Any help would be appreciated.
ws.post('/nextq',function(req,res){
var user_name = req.body.InputName;
var user_add = req.body.InputAddress;
var user_mno=req.body.InputMno;
var user_age=req.body.InputAge;
var user_email=req.body.InputEmail;
var user_job=req.body.InputJob;
console.log(user_name + user_add + user_mno + user_age + user_email + user_job);
if(!(user_name = null) || !(user_add = null) || !(user_mno = null)|| !(user_age = null)|| !(user_email = null)|| !(user_job = null))
{
client.connect(function(err){
if(err){
return console.error('Could not connect to postgres' , err);
}
client.query("INSERT INTO \"Users\" (\"name\",\"address\",\"mno\",\"email\",\"age\",\"job\") VALUES ('user_name','user_add','user_mno','user_email','user_age','user_job')",function(err,result){if(err) {
return console.error('error running query', err);
}