-
-
Save julp/f9fc1291344e4483171fb17251a4305c to your computer and use it in GitHub Desktop.
[OC] Card deck (modulo 3 sur le résultat d'une requête)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="card-deck"> | |
<?php | |
$i = 0; | |
while($product = mysqli_fetch_assoc($result)): | |
if ($i && ($i % 3) == 0): | |
?> | |
</div> | |
<div class="card-deck"> | |
<?php endif ?> | |
<div class="card"> | |
<form> | |
<img src="<?= htmlspecialchars($product['photo']) ?>" class="card-img-top" alt="..."> | |
<div class="card-body"> | |
<h5 class="card-title"><?= htmlspecialchars($product['product'], ENT_NOQUOTES) ?>|<?= htmlspecialchars($product['brand'], ENT_NOQUOTES) ?></h5> | |
<p class="card-text"><?= htmlspecialchars($product['descript'], ENT_NOQUOTES) ?></p> | |
</div> | |
<div class="card-footer"> | |
<?php if(isset($_SESSION['auth'])): ?> | |
<small class="text-muted"><button type="submit" class="btn btn-outline-info btn-sm"><?= $product['price'] ?> €</button></small> | |
<?php if($_SESSION['auth']->username == "admin"): ?> | |
<small class="text-muted"> | |
<a href="edit.php?id=<?= $product['id'] ?>">Modifier </a> | |
<a href="delete.php?id=<?= $product['id'] ?>"> Supprimer</a></small> | |
<?php endif ?> | |
<?php else: ?> | |
<small class="text-muted">A partir de <?= $product['price'] ?> €<br><a href="login.php">Connectez-vous pour plus d'informations</a></small> | |
<?php endif ?> | |
</div> | |
</form> | |
</div> | |
<?php | |
$i++; | |
endwhile | |
?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment