Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 150339f2 authored by 65160014's avatar 65160014
Browse files

Initial commit

parent 7d3795ee
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ const db = mysql.createPool({
port: process.env.DB_PORT,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME, // replace with your database name
database: process.env.DB_NAME,
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
......
......@@ -14,7 +14,7 @@ module.exports = {
loginSubmit: (req, res) => {
const { email, password } = req.body;
db.query('SELECT * FROM Users WHERE email = ?', [email], (err, result) => {
db.query('SELECT * FROM users WHERE email = ?', [email], (err, result) => {
if (err) throw err;
if (result.length > 0) {
......
......@@ -3,7 +3,7 @@ const db = require('../app').db;
module.exports = {
// ฟังก์ชันในการดึงข้อมูล user โดยใช้ email
getUserByEmail: (email, callback) => {
db.query('SELECT * FROM Users WHERE email = ?', [email], (err, result) => {
db.query('SELECT * FROM users WHERE email = ?', [email], (err, result) => {
if (err) return callback(err);
callback(null, result);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment