2
I have a student enrollment system in a college system.
Part of the code showing the error or not:
while (($matricula = fgets($handle, 1024)) !== false) {
$cont++;
erro("Lendo matricula $cont de $qtde_matriculas");
$matricula = trim($matricula);
if(!is_numeric(trim(substr($matricula,0,5)))){
erro("matricula $cont invalido [$matricula]");
}else{
$arrayReturn = buscarnafaculdade( $matricula );
if($arrayReturn['status'] == "ERROR" || $arrayReturn == false){
erro(" ERRO servidor faculdade para inserir matricula [$matricula]");
$result = print_r($arrayReturn);
erro($result);
}else{
erro("matricula [$matricula] inserido no no sistema!");
}
}
$matricula = null;
Turns out, if error occurs I jump to the next one. I’d like to change it.
I would like a certain number of attempts to be made and if I continue to make the mistake in:
if($arrayReturn['status'] == "ERROR" || $arrayReturn == false){
erro(" ERRO servidor faculdade para inserir matricula [$matricula]");
Then it would stop.
It is possible?
Thank you! It worked!
– Marcelo