Hello, I am working on a script that reads a record from a datbase and that becomes the image file name. If it is not found then it should display another default image. Here is my script:
[code=php]
$imagefile = “/images/”. $row[“id”] . “.jpg”;
if (file_exists($imagefile)){
echo “<td colspan=”2″ rowspan=”3″><img class=”border” src=”.images”. $row[“id”] .”.jpg” width=”120″ height=”111″ />n”;
}
else {
echo “<td colspan=”2″ rowspan=”3″><img class=”border” src=”/images/defimage.jpg” width=”120″ height=”111″ />n”;
}
I get a display of only the default image (“defimage.jpg”) and I do have files for some of the products. It displays fine if i take out that if else and file_exists(). Does anyone know if im using the correct function? I tried fopen() but that is definetely not the way to go…any suggestions or feedback is greatly appreciated..thanks!