Please help me on this as I am a newbie on PHP. I am reading from a file and loading the content in an array. Now I want to display only one record but the result is giving a blank page. When I display the whole array it works fine but I put the if statement to get a specific record, it doesn't work. Please see below code.
<?php
$strreturn = "H123458";
$customerRec = array();
$destination_url ="./users/patient.txt";
$myfile = fopen($destination_url, "r") or die("Unable to open file!");
$c=0;
while(!feof($myfile)) {
$customerRec[$c++] = fgets($myfile);
}
fclose($myfile);
for($i=0;$i<count($customerRec);$i=$i+6){
if($customerRec[$i] == $strreturn){
for($t=$i;$t<6+$i;$t++){
echo "$customerRec[$t]"."<br/>";
}
}
}
?>
--patient.txt----
H123456
Hemede
1234567896541
2018-09-01
2018-09-30
CPT805
H123457
Mario
9876543214569
2018-09-02
2018-09-29
CPT280
H123458
Michael
3698521478965
2018-09-03
2018-09-28
PML209
H123521
Laurant
7532159852365
2018-09-04
2018-09-24
FRS965
H123954
Theos
9658741258632
2018-09-05
2018-09-19
OTH77