diff --git a/add_item.php b/add_item.php
new file mode 100644
index 0000000..ac25236
--- /dev/null
+++ b/add_item.php
@@ -0,0 +1,56 @@
+connect_error) {
+ die('Connection failed: ' . $conn->connect_error);
+}
+
+$stmt = $conn->prepare('INSERT INTO whishes (title, description, link, image, price) VALUES (?, ?, ?, ?, ?)');
+
+if (false === $stmt) {
+ die('prepare() failed: ' . htmlspecialchars($mysqli->error));
+}
+
+$rc = $stmt->bind_param('ssssi', $ItemTitle, $ItemDescription, $imageLocalLink, $ItemImage, $ItemPriceCents);
+if (false === $rc) {
+ die('bind_param() failed: ' . htmlspecialchars($stmt->error));
+}
+
+$rc = $stmt->execute();
+if (false === $rc) {
+ die('execute() failed: ' . htmlspecialchars($stmt->error));
+}
+
+$stmt->close();
+$conn->close();
+
+header('Location: ' . $_SERVER['HTTP_REFERER']);
diff --git a/include/listgenerator.php b/include/listgenerator.php
index 6a0eaa7..08744d1 100644
--- a/include/listgenerator.php
+++ b/include/listgenerator.php
@@ -1,10 +1,14 @@

@@ -13,8 +17,8 @@ function generateListItem($ListItemID, $ItemImage, $ItemTitle, $ItemPrice, $Item
' . $ItemComment . '
' . $formatter->formatCurrency($ItemPrice / 100, 'EUR') . '
diff --git a/index.php b/index.php
index 7adb115..9fcf14e 100644
--- a/index.php
+++ b/index.php
@@ -60,14 +60,14 @@ include_once('config/config.php');
// Check connection
if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
+ die('Connection failed: ' . $conn->connect_error);
}
- $sql = "SELECT ID, title, description, image, reserved, price FROM whishes";
+ $sql = 'SELECT ID, title, description, link, image, reserved, price FROM whishes';
$result = $conn->query($sql);
if ($result !== false && $result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
- generateListItem($row['ID'], $row['image'], $row['title'], $row['price'], $row['description']);
+ generateListItem($row['ID'], $row['image'], $row['title'], $row['link'], $row['price'], $row['description'], $row['reserved']);
}
$conn->close();
}
@@ -108,7 +108,7 @@ include_once('config/config.php');
-
+
@@ -116,12 +116,59 @@ include_once('config/config.php');
Add new Item
+
+
+
+
+
+
+