I have this mysqli query but it only inserts the first iteration. But when I comment the insert statement and just echo the values, the loop works fine.
$max = count($_SESSION['cart']);
for($x=0; $x<$max; $x++)
{
$product = $_SESSION['cart'][$x]['product_desc'];
$quantity = $_SESSION['cart'][$x]['quantity'];
$sql = "insert into waybills (product_desc, quantity) values ('$product', '$quantity')";
mysqli_query($link, $sql);
}
Is there any error that is making the loop not working?