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 use near 'WHERE id = '1'' at line 1
at Query.Sequence._packetToError (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
at Query.ErrorPacket (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\protocol\sequences\Query.js:79:18)
at Protocol._parsePacket (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\protocol\Protocol.js:291:23)
at Parser._parsePacket (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\protocol\Parser.js:433:10)
at Parser.write (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\protocol\Parser.js:43:10)
at Protocol.write (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\protocol\Protocol.js:38:16)
at Socket.<anonymous> (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\Connection.js:88:28)
at Socket.<anonymous> (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\Connection.js:526:10)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
--------------------
at Protocol._enqueue (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Connection.query (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\mysql\lib\Connection.js:198:25)
at exports.update (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\server\controllers\userController.js:81:14)
at Layer.handle [as handle_request] (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\express\lib\router\layer.js:95:5)
at next (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\express\lib\router\route.js:144:13)
at Route.dispatch (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\express\lib\router\route.js:114:3)
at Layer.handle [as handle_request] (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\express\lib\router\layer.js:95:5)
at D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\express\lib\router\index.js:284:15
at param (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\express\lib\router\index.js:365:14)
at param (D:\Softwares\usermana\Nodejs-UserManagement-Express-Hbs-MySQL\node_modules\express\lib\router\index.js:376:14) {
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 'WHERE id = '1'' at line 1",
sqlState: '42000',
index: 0,
}
The data from user table:
undefined
我试图从管理页面动态更新我的登录详细信息,但当我点击提交时,它抛出了一个错误
这是我的数据库结构
[
2条答案
按热度按时间dzjeubhm1#
where前面的逗号不应该在这里。去掉它。
2skhul332#
在你的代码中有一个额外的单引号,请删除它。
在问号
?'
之后"现在密码是多少"
WHERE标识=?',
代码应该是什么?
WHERE标识=?,