Mysql 代码:';ER#u PARSE#u ERROR';,错误号:1064,sqlMessage:";您的SQL语法有错误;
我正在制作一个API,虽然所有的语法和查询都是正确的,但它向我展示了Mysql 代码:';ER#u PARSE#u ERROR';,错误号:1064,sqlMessage:";您的SQL语法有错误;,mysql,sql,node.js,api,Mysql,Sql,Node.js,Api,我正在制作一个API,虽然所有的语法和查询都是正确的,但它向我展示了 code: 'ER_PARSE_ERROR', errno: 1064, sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'load' at line 1"
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'load' at line 1",
sqlState: '42000',
index: 0,
sql: 'select * from load'
我的代码
Router.get("/",(req,res)=>{
mysqlConnection.query("select * from load",(err,rows,fields)=>{
if(!err){
res.send(rows);
}else{
console.log(err);
}
})
});
“load”是MySQL数据库中的表名,我想从中获取所有内容。load是MySQL中的保留字,作为或的一部分。如果要将“load”用作表名,则必须使用反勾号对其进行引用:
select * from `load`
这对我有用。谢谢。@ SuniSaulHuu:那你应该考虑一下。