I am trying to get the default image if no image is uploaded by the user but I get always the image which is uploaded by the user and the default does not show up.
Here is SQL query code and CSS part.
$query="INSERT INTO tbl_images (f_naam) VALUES ('$filename')";
if($result=mysql_query($query) or die ('query fout') ){
?>
<img src="data/<?php echo $filename; ?>" width="220" />
<?php }else{ ?>
<img src="http://www.istockphoto.com/file_thumbview_approve/12716227/2/istockphoto_12716227-close-up-of-a-cute-young-couple-smiling-togetherjpg" width="220" />
</div>
<?php } ?>
i am not sure if this is the problem BUT i suspect that even if
$filenameis empty, the query would run successfully and you would go into the section trying to display the uploaded image. So you might want to put a check on$filenameand make sure it has something before running the query.I might do it something like this, untested code though.