1
$matricula=$_POST['matricula'];
foreach ($aluno as $objeto){
if ($objeto->matricula==$matricula ) {
echo $objeto->status;
if ($objeto->$mail == false and "Ativo" == $objeto->status ) {
echo "Sua conta foi criado com sucesso";
} elseif ($objeto->$mail == true) {
echo "VocÊ já possui email";
}else{
echo "Voce está inativo";
}
}
}
This $object->$mail really is a Boolean value?
– Kayo Bruno
What error are you getting? Give more details about your problem so we can help you more accurately and easily.
– Bruno Peres
Yes, the comparison that doesn’t work is this "Active" == $object->status
– Lucas Soares
If possible place the return of the $object variable
– Kayo Bruno
Comparison "Active" == $object->status always from false, even if equal.
– Lucas Soares
So echo '<pre>'; var_dump($object); die; and put here the return.
– Kayo Bruno
Object(Students)#7 (6) { ["name"]=> string(23) "Gabriela Santos Ribeiro" ["matricula"]=> string(6) "109647" ["telephone"]=> string(10) "99999-9955" ["mail"]=> string(15) "[email protected]" ["status"]=> string(7) "Active " Email n is Boolean.
– Lucas Soares
The status value is set to 7 characters, while active only has 5, so there are unwanted characters there.
– Woss