Problem in the Foreach array

0

My problem is this, I hope you can help me:

I'm looking for some records from the "Products" table in my database and displaying it on the front. I'm using a Foreach to bring these logs and there's also a button that will create a session and add these products to my cart. The problem is not in the cart itself but in the list where the button that will add is located. It calls an Action referencing whether there is an action (the action, né) and the product id. The path looks something like this:

---> localhost / LoginandRegisterLanchenet / cart.php? add = cart & id =

The id is empty and refers to nothing resulting in a URL error not found. Here is the code below:

<?php
$conect = new db();
$conect = $conect ->conectar();



$query = mysqli_query($conect, "SELECT * FROM produto");
$result = mysqli_fetch_all($query);


echo "<div  class='quadcard1'>CRIAR RESERVA<br><br>";
echo "<div class='quadcard2' > Cardápio<br><br>";
foreach ($result as $item){
    echo "<div class='quadcard'>";
    echo "<div class='produtos'>".$item[1]."<a href='carrinho.php?add=carrinho&id='".$item[0]."'><input class='btn btn-primary' type='button' value='+' style='display: relative; float : right; margin-right :1rem; margin-top: 0.5rem;'></a><br>".$item[3]." <label class='valor'> Valor: R$ ".$item [5]."</label></div></div>";
}

echo "<div></div>";
echo "</div></div>";
?> 

Has anyone been able to identify the error?

If you need more details just say I add.

Thank you !! Att.

    
asked by anonymous 26.06.2018 / 02:28

0 answers