Code causing issue
let query = `update users set email = ? and password = ? where id = ?`;
console.log(query);
connection.query(query,[id,email,pass], function(error, result, fields) {
if (error) {
console.log(`error ${error}`);
callback(false);
}else {
console.log(result);
if(result.affectedRows>0)
callback(true);
else
callback(false);
}
});
solution : Just replace AND with comma
let query = `update users set email = ?,password = ? where id = ?`;
console.log(query);
connection.query(query,[id,email,pass], function(error, result, fields) {
if (error) {
console.log(`error ${error}`);
callback(false);
}else {
console.log(result);
if(result.affectedRows>0)
callback(true);
else
callback(false);
}
});
Top comments (0)