I have a question to see if someone can help me In what I am developing I need that on day 1 of each month for example the number of breakdowns starts with 1 and then of course I will add 1 consecutively. Already for day 2 is to get the last and go adding 1, I have echo to get the last one and I add 1 but in the reset on day 1 I do well in the first but then I kept the 1, I'm half tangled with that.
I have this code
$dia = date("d");
foreach ($max_id as $maximo):
//Obtengo el numero maximo de averia
$maxID = $maximo['nro_averia'];
//extraigo los 3 ultimos digitos que es lo que necesito
$nueva_averia = substr($maxID, -3);
$contador=0;
//Si es el dia es 1 lo pongo a 1
if ($dia == 1 && $contador==0){
$nueva_averia = 1;
$contador=1;
} else {
$nueva_averia += 1 ;
}
endforeach;
Greetings and thanks in advance