I don t know why the second round of foreach give me this error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '8,1)' at line 2"
$Ntavolo = Array ( [0] => 46 [idordine] => 46 ) ;
$queryordine= "SELECT `idordine` FROM `ordine` WHERE `tavolo`=$Ntavolo ORDER BY `ordine`.`dataora` DESC LIMIT 1";
$result = mysqli_query($con,$queryordine);
$array=Array ( [0] => Array ( [id] => 1 [qta] => 1 ) [1] => Array ( [id] => 8 [qta] => 1 ) ) ;
foreach($array as $value){
$row = mysqli_fetch_array($result);
print_r($row);
print_r($array);
$idordine=$row['idordine'];
$queryinsert="INSERT INTO `dettaglio` (`iddettaglio`, `idordine`, `idprodotto`, `quantita`)
VALUES (NULL, ".$idordine.",".$value['id'].",".$value['qta'].");";
mysqli_query($con,$queryinsert)or die(mysqli_error($con));
echo($queryinsert);
};?>