I'm getting an error I don't understand when sending the parameters to my method, I thought my query was wrong but I did it manually and mySQL did what it had to do. So the problem is in my code but I don't seem to find where, thanks in advance.
exports.defav = function(id_user, id_restaurant, callback){
console.log(id_user + " " + id_restaurant); //Just making sure i'm reciving correclt
pool.getConnection(function(err, connection){
if(err){
console.log(err);
callback(true);
return;
}
connection.query("DELETE FROM favorites WHERE id_user = ? AND id_restaurant = ?", id_user, id_restaurant, function(err, results) {
console.log("SUCCESS: Removed from fav ");
connection.release();
if(err){
console.log(err);
callback(true);
return;
}
callback(results);
});
});
};
The error I'm getting is:
throw err; // Rethrow non-MySQL errors ^
TypeError: this._callback.apply is not a function