Replies: 1 comment 1 reply
-
|
Hi, @Linhieng 🙋🏻♂️ How about changing from - sql = 'INSERT INTO `user` (`username`, `password_hash`) VALUE (?, ?)'
+ sql = 'INSERT INTO `user` (`username`, `password_hash`) VALUES (?, ?)' |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
❌:
✅:
let sql = 'SELECT * FROM `user` WHERE `username` = ? LIMIT 1' let values = [username] - let [row]= await conn.execute(sql, values) + let result = await conn.execute(sql, values) if (result[0].length > 0) { return 'existed' } sql = 'INSERT INTO `user`(`username`, `password_hash`) VALUE (?, ?)' values = [username, password_hash] - [row] = await conn.execute(sql, values) // ❌ Error: Malformed communication packet. + result = await conn.execute(sql, values) // ✅ return resultWhy?
Beta Was this translation helpful? Give feedback.
All reactions