query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$imagePath = !empty($row['image']) ? 'image/' . $row['image'] : 'image/default.jpg'; // Chemin correct vers les images
echo '
';
echo '';
echo '
';
echo '
';
}
} else {
echo '';
echo '
';
echo '';
echo '' . htmlspecialchars($row['nom']) . '
'; echo '' . number_format($row['prix'], 0, ',', ' ') . '
'; echo 'Aucun produit disponible.
';
}
?>