diff --git a/public/bestellformular/bestellformular.html b/public/bestellformular/bestellformular.html
index 182956d..b3ece7d 100644
--- a/public/bestellformular/bestellformular.html
+++ b/public/bestellformular/bestellformular.html
@@ -45,6 +45,10 @@
+
+
+
Ihre Bestellung
+
+
+
-
+
Ihre Bestellung:
-
-
-
Kundennummer:
-
Produkt-ID:
-
Produktname:
-
Preis:
-
+
+
+
Kundennummer:
+
Produkt-ID:
+
Produktname:
+
Preis:
+
-
+
diff --git a/server.js b/server.js
index 899f6c2..388aba4 100644
--- a/server.js
+++ b/server.js
@@ -130,7 +130,7 @@ app.get('/api/products/sportwagen', async (req, res) => {
app.post('/api/user/registration', (req, res) => {
// SQL-Query für Nutzerregistration
const {name, lower_name, email, passwd} = req.body;
- const sql = "INSERT INTO user (name, lower_name, email, passwd, passwd_hash_algo) VALUES (?, ?, ?, ?, 'none')"
+ const sql = "INSERT INTO webshop.user (name, lower_name, email, passwd, passwd_hash_algo) VALUES (?, ?, ?, ?, 'none')"
// Query abschicken
db.query(sql, [name, lower_name, email, passwd], (err, results) => {
@@ -172,8 +172,8 @@ app.post('/api/bestellung', (req, res) => {
const {user_id, product_id} = req.body;
- const sql1 = 'INSERT INTO order_details (, user_id, payment_id, total) VALUES (?, null, null)'
- const sql2 = 'INSERT INTO order_items (user_id, product_id, quantity, order_id) VALUES (?, ?, 1, ?)';
+ const sql1 = 'INSERT INTO webshop.order_details (user_id, payment_id, total) VALUES (?, 1, 0)'
+ const sql2 = 'INSERT INTO webshop.order_items (user_id, product_id, quantity, order_id) VALUES (?, ?, 1, ?)';
db.query(sql1, [user_id, 1, 100.00], (err1, result1) => {
if (err1) {
@@ -190,11 +190,11 @@ app.post('/api/bestellung', (req, res) => {
});
});
-app.get('/api/bestellung/daten', (req, res) => {
+app.post('/api/bestellung/daten', (req, res) => {
const user_id = req.body;
- const sql = 'SELECT oi.user_id, oi.product_id, p.product_name, p.price FROM order_items oi INNER JOIN product p ON oi.product_id = p.id WHERE user_id = ? '
+ const sql = 'SELECT oi.user_id, oi.product_id, p.name AS product_name, p.price FROM order_items oi INNER JOIN product p ON oi.product_id = p.id WHERE oi.user_id = ? '
db.query(sql, [user_id], (err, results) => {
if (err) {
console.error('Fehler beim Abrufen der Bestellung: ', err);