我正在尝试在我的页面上创建个人资料图片上传系统,但我遇到了一个挑战,图片回显四次,默认图片在页面上显示四次,当我上传图片时,它也会这样做。我需要有关如何解决此问题的帮助,我只需要在页面上显示一张图像。
<?php
require("./includes/databaseHandler.php");
$id = $usersData['id'];
$sql = "SELECT * FROM users";
$result = mysqli_query($con, $sql);
if(mysqli_num_rows($result) > 0 ){
while(mysqli_fetch_assoc($result)){
$sqlImg = "SELECT * FROM profileimg WHERE userid = '$id'";
$resultImg = mysqli_query($con, $sqlImg);
while($rowImg = mysqli_fetch_assoc($resultImg)){
echo "<div class='user-container'>";
if($rowImg['status'] == 0){
echo "<img src = 'uploads/profile".$id.".jpg' >";
}else{
echo "<img src = 'uploads/profiledefault.jpg'>";
}
echo "</div>";
}
}
}
?>
一只名叫tom的猫