<div class="uk-container">
    <div class="uk-grid uk-child-width-1-3" uk-grid>
        <?php 
        $query= "SELECT * FROM produc";
        $result= mysqli_query($conexion,$query);

        while($row = mysqli_fetch_array($result)) {?>
            <div>
                <form method="POST" action="tienda.php?id=<?=$row['id'] ?>" class="uk-card uk-card-default uk-card-body">
                    <img src="img/<?=$row['img']?>">
                    <h5 class="uk-text-center"><?=$row['nombre']?></h5>
                    <h5 class="uk-text-center">$<?=number_format($row ['precio'],2)?></h5>
                    <input type="hidden" name="nombre" value="<?= $row ['nombre']?>">
                    <input type="hidden" name="precio" value="<?= $row ['precio']?>">
                    <input type="number" name="quantity" value="1" class="uk-input">
                    <input type="submit" name="anadealcarrito" class="uk-button uk-button-primary uk-width-1-1" value="Añadir">
                </form>
            </div>
        <?php } ?>
    </div>
</div>
</div>
