connection.query("SELECT email, password FROM authenticate where email=?", email,
function (error, result) {
if (error) {
throw error;
} else {
if (result.length == 0) {
console.log('name not available');
res.sendFile(path.join(__dirname + "/public/applyFailure.html"));
} else if (result[0].password == password) {
console.log(userData);
connection.query("INSERT INTO userapplications SET ? ", userData,
function (error, result, fields) {
if (error){
throw error;
}
else{
console.warn("insertion successful");
res.sendFile(path.join(__dirname + "/public/applySuccess.html"));
}
});
} else {
console.log('invalid user and password');
res.sendFile(path.join(__dirname + "/public/apply.html"))
}
}
});
connection.end();
Cannot enqueue Query after invoking quit.
The database gets connected for some reason the data doesn't get added into the table. I'm a beginner.