diff --git a/controllers/loginController.js b/controllers/loginController.js
index 0ef09e331296f71a84ad0793331683ccf104e51f..a7de7484fe03f120c362cee5d4a8977eecd8ac55 100644
--- a/controllers/loginController.js
+++ b/controllers/loginController.js
@@ -18,7 +18,7 @@ module.exports = {
             const user = rows[0];
             const match = await bcrypt.compare(rpassword, user.password);
             if (match) {
-                req.session.userId = user.id
+                req.session.userId = user.user_id; // ใช้ user_id แทน id
                 res.redirect('/');
             } else {
                 req.flash('message', 'Password incorrect');