while ($row = $checkUser->fetch_assoc()) {
$arr = $row['username'];
}
像这样检查只是不起作用
if($arr !="john"){
}else{
}
如何检查$ row ['username']是否包含字符串“john”?
答案 0 :(得分:0)
假设你正确得到这个$row['username']
。然后
$arr = array();
while ($row = $checkUser->fetch_assoc()) {
$arr[] = $row['username'];
}
if(in_array("john",$arr)){
//there is a username john in the array
}else{
//this is no john inside the array
}