$objetos = json_decode($_POST['objetos']);
$query1 = "DELETE FROM `usuarioObjeto` WHERE idusuario=" . $id . "";
$result1 = mysqli_query($conn, $query1) or die('Consulta fallida: ' . mysqli_error());
$size = count($objetos); //this works
//this do not insert into the BD
for ($k = 0; $k < $size; $k++) {
$ido = intval($objetos[$k]['id']);
$cantidad = intval($objetos[$k]['cantidad']);
$query2 = "INSERT INTO `usuarioObjeto`( `idUsuario`, `idObjeto`, `cantidad`) VALUES (" . $id . "," . $ido . "," . $cantidad . ")";
$result2 = mysqli_query($conn, $query2) or die('Consulta fallida: ' . mysqli_error());
}
thanks
and i have tried to access to one property like this but nothing
$ido = intval($objetos[0]['id']);