Greetings, my problem is that every 3 inserted records I must make an increase in value, example: I have my table details_quotes in which I keep the amounts of each quota according to an established amount, but every time you insert 3 records you must increase the amount 20%. This is the function in which I insert:
function cuotas($cantidad,$monto){
$query = "INSERT INTO cuotas (cantidad,monto)VALUES('$cantidad','$monto')";
$sql = $mysqli->query($query);
$val = mysqli_insert_id($mysqli);
for($i=1; $i <= $cantidad; $i++){
$query2 = "INSERT INTO
detalle_cuotas(id_cuota,monto)VALUES('$val','$monto')";
$sql2 = $mysqli->query($query2);
}
if($sql>0 && $sql2>0):
header('Location:admin.php');
else:
echo mysqli_error($mysqli);
endif;
}