当我尝试使用node-mysql在MYSQL数据库上调用查询时,我遇到了解析错误.我很确定查询有效.毫无疑问,它通过phpmyadmin运行.
Message.save = function(message, callback){
db.query("INSERT INTO e_message (chatid, message, userid) VALUES(" + message.chatid + ", '" + message.message +"', " + message.userid + "); SELECT * FROM e_message WHERE chatid = " + message.chatid + " ORDER BY timestamp DESC LIMIT 0, 1;",
function(err, rows, fields){
console.log(err);
callback(err, new Message(rows[0]));
});
}
Run Code Online (Sandbox Code Playgroud)
我收到了以下错误:
{ [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to …Run Code Online (Sandbox Code Playgroud)