【发布时间】:2021-07-14 18:04:31
【问题描述】:
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();
调用退出后无法将查询入队。
由于某种原因,数据库已连接,数据未添加到表中。 我是初学者。
【问题讨论】:
-
userData的值是多少? -
它是一个简单的对象
-
db connected { education: 'BE in CSE/ISE', design: 'Artificial Inteligence (Python)', userView: '222' } -
是的。我无法弄清楚。我正在尝试在不同表的查询中查询不同的表。这会产生任何问题吗? `
标签: mysql node.js express mysql-error-1064