I have a student enrollment system in a college system.
Part of the code where the error is or is 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;
It turns out that if an error occurs I jump to the next one. I'd like to change that.
I would like a number of attempts to be made and if I kept the error in:
if($arrayReturn['status'] == "ERROR" || $arrayReturn == false){
erro(" ERRO servidor faculdade para inserir matricula [$matricula]");
Then I would stop.
Is it possible?