while (!feof($fail)) {
$medan = explode(",", fgets($fail));
$berjaya = false;
}
if ($berjaya == true)
The variable
$berjaya
is defined in the
while
block, so as soon as the loop ends it no longer exists. So move its definition above the loop and it should work:
$berjaya = false;
while (!feof($fail)) {
$medan = explode(",", fgets($fail));
$berjaya = false;
}
if ($berjaya == true)