Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit feeb61ce authored by 65160394's avatar 65160394
Browse files

Project Round 3

parent e07c4097
No related branches found
No related tags found
No related merge requests found
......@@ -89,16 +89,16 @@ exports.getCreateTour = (req, res) => {
// บันทึกทัวร์ใหม่
exports.createTour = async (req, res) => {
try {
const { name, location, price, description } = req.body;
const { name, description, price, duration } = req.body;
// ตรวจสอบว่าข้อมูลถูกต้อง
if (!name || !location || !price || !description) {
if (!name || !description || !price || !duration) {
return res.status(400).send('กรุณากรอกข้อมูลให้ครบทุกช่อง');
}
await pool.query(
'INSERT INTO tours (name, location, price, description) VALUES (?, ?, ?, ?)',
[name, location, price, description]
[name, description, price, duration]
);
res.redirect('/');
} catch (error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment