What I wanna do is take the variable name $ingreso
and increment it at the end to send a lot of variables with the same name but with a different number at the end,$ingreso1
, ingreso2
etc, but I don't know how to concatenate it correctly.
Please Help.
PHP Code:
while ( $cont<= 15){
$sql = "INSERT INTO ingreso (vlr_ingreso, periodo_ingreso, proyecto_id_proyecto)
VALUES ('$ingreso".$cont."','$cont','$proyecto_id');";
$insert = mysqli_query($con, $sql);
}
But it keeps returning $ingreso
without the number at the end.
What I think its happening is that the $cont
is being added at the end of the $ingreso
content, not to the variable itself
Thanks for any help