diff --git a/productpage.php b/productpage.php index 47af509..a900568 100644 --- a/productpage.php +++ b/productpage.php @@ -94,36 +94,36 @@ if ($checkResult->num_rows === 0) { } ?> - + // FALL 2: Von der Wunschliste entfernen (NEU) + elseif (isset($_POST['remove_wishlist']) && $alreadyInWishlist) { + $stmtDel = mysqli_prepare($conn, "DELETE FROM userFavorites WHERE productID = ? AND userID = ?"); + if ($stmtDel) { + mysqli_stmt_bind_param($stmtDel, 'ii', $productId, $_SESSION['user_id']); + mysqli_stmt_execute($stmtDel); + mysqli_stmt_close($stmtDel); + + // Status aktualisieren, damit gleich wieder der "Hinzufügen"-Button erscheint + $alreadyInWishlist = false; + } + } +} +?> num_rows === 0) { -