In my node JS I want to send a query to database to delete a record with under two conditions. One is id of the user and the second one is the name. However When I try to do this I receive an error:
throw err; // Rethrow non-MySQL errors
^
TypeError: this._callback.apply is not a function
And here is my code:
app.post('/delete',function(req,res){
received = req.body;
toDelete = {
name: received.name,
id: received.id
}
connection.query("DELETE FROM myTable WHERE User_ID = ? AND NAME = ?", toDelete.id,
toDelete.name, function(err,results){
if(err){return console.log(err)}
})
});
I think that number of passing arguments could be a problem. But how can I fix that when I want to use two parameters to find a record to delete?
via andrzej541
No comments:
Post a Comment