how sql record match into text file using php

i try to match sql record into text file.
if match sql to text file result show " ok " if not match result show " not ok "
i try this code but result show only one

sql logininform
“loginid”
1
2
3
4
5
6
7
8
9

create text file file

readmessage.txt
2,4,5

read.php

require(‘db.php’);
$result = mysqli_query($conn,“SELECT * FROM logininform”);
$users = fopen(“readmessage.txt”, “r”) or die(“Unable to open file!”);
$check = explode(",", fgets($users));
fclose($users);

while($myrowref = mysqli_fetch_array($result)){
$lig = $myrowref[“loginid”];

if ($lig == $check[0]) {
echo ‘ok
’;
echo $lig.’
’;
}else{
echo ‘not ok
’;
echo $lig.’
’;
}

}

?>

result show
not ok
1
ok
2

not ok
3
not ok
4
not ok
5
not ok
6
not ok
7
not ok
8
not ok
9
but 4 and 5 not show " ok "
how can dow

Why are you trying to match a record in the database to a txt file?

What is in the text file, what is in the database record?

i solved this problem

Sponsor our Newsletter | Privacy Policy | Terms of Service