一旦满足要求,我的代码回显Hey或Hello两次。
这应该检查一个人是否有上传的东西,这取决于他们是否有或没有消息显示。
$sql = "SELECT * FROM users";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$sqlImg = "SELECT * FROM users WHERE idUsers='$current'";
$resultImg = mysqli_query($conn, $sqlImg);
while ($rowImg = mysqli_fetch_assoc($resultImg)) {
if ($rowImg['profile_img'] == 0) {
echo "hey";
} else {
echo "Hello";
}
}
}
}
我希望输出回显一次,但实际输出回显两次。
跃然一笑