Forum Moderators: coopster
The image file is picked up by using the article field and adding ".jpg" to it. Is this causing the problem, rather than having a dedicated image column in the database? Or is it just a syntax or bad coding error (Ihave tried using various double and single quotes within code).
If anyone has any ideas I'd be really grateful to hear them.
Thanks
<?php
$image= ("images/"$row_Recordset1['article']".jpg");
if (@fclose(@fopen("$image", "r"))) {
print("<img src='images/' $row_Recordset1['article'] '.jpg' border='1'>");
}
else {
print("<img src='images/noimage.jpg'>");
}
?>
You need to concatenate your $image variable together, notice the periods which represent concatenation [php.net]:
$image= 'images/' . $row_Recordset1['article'] . '.jpg';
$image= 'images/' . $row_Recordset1['article'] . '.jpg';
if (is_file($image)) {
print "<img src=\"$image\" border=\"1\">";
} else {
print '<img src="images/noimage.jpg">';
}