Button for adding to wishlist works, Database userFavorites included
This commit is contained in:
parent
8b8db58877
commit
203a6901cf
@ -5,8 +5,6 @@ ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
session_start();
|
||||
|
||||
// 1) DB-Verbindung (einmal)
|
||||
$servername = "localhost";
|
||||
$port = 3306;
|
||||
|
||||
@ -178,9 +178,54 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class ="shop-offers"
|
||||
|
||||
<?php
|
||||
$stmt = mysqli_prepare($conn,
|
||||
"SELECT price, shippingCost, inStock, shops.name, shops.website
|
||||
FROM offers
|
||||
INNER JOIN shops ON
|
||||
offers.shopID = shops.shopID WHERE offers.productID = ?");
|
||||
|
||||
$stmt->bind_param("i", $productId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
$shopInfo = [];
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$shopInfo[] = $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class="shop-offers">
|
||||
|
||||
<?php if (!empty($shopInfo)): ?>
|
||||
|
||||
<?php foreach ($shopInfo as $shop): ?>
|
||||
|
||||
<div class="shop-line">
|
||||
<a href="<?= htmlspecialchars($shop['website']) ?>" target="_blank">
|
||||
<?= htmlspecialchars($shop['name']) ?>
|
||||
</a><br>
|
||||
|
||||
Preis: <?= htmlspecialchars($shop['price']) ?> € <br>
|
||||
Versand: <?= htmlspecialchars($shop['shippingCost']) ?> € <br>
|
||||
Lagernd: <?= $shop['inStock'] ? "Ja" : "Nein" ?>
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php else: ?>
|
||||
<p>Keine Shops bieten dieses Produkt an.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php $stmt->close(); ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user