Click here to Skip to main content
15,899,935 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i have an upload feature and i wanted to set a default image if profile picture not uploaded

below code shows default image but when i upload the picture the default image stays there and doesnt replace it?

What I have tried:

$stmt = $conn->query("SELECT ProfilePicture FROM Profile WHERE UserID='$id'");
while($image =$stmt->fetch(PDO::FETCH_ASSOC)) {
if (!$_REQUEST['file']) {
echo "<img src=imgs/default.jpg width='150' height='150'/>";	
} else {
echo "<img src=uploads/".$image['Picture']."' width='150' height='150'/>"; 
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900