I have a database in which only some of the records have a photo associated with them. If the photo exists, I want to display it. If there is no photo, I don't want to display anything.
My images are located in the folder called "../images/recipes/320/". Each image is named according to the record ID, i.e., the image for Recipe_ID=1 is called "../images/recipes/320/1.JPG" and the image for Recipe_ID=2 is "../images/recipes/320/2.JPG" etc. I am having trouble concatonating the file name in php. The code always indicates that the file does not exist, even when it does.
My images are located in the folder called "../images/recipes/320/". Each image is named according to the record ID, i.e., the image for Recipe_ID=1 is called "../images/recipes/320/1.JPG" and the image for Recipe_ID=2 is "../images/recipes/320/2.JPG" etc. I am having trouble concatonating the file name in php. The code always indicates that the file does not exist, even when it does.
Code:
if
(file_exists("../images/recipes/320/". $row_rs_recipe['Recipe_ID']."JPG"))
{echo("<img src=\"../images/recipes/320/". $row_rs_recipe['Recipe_ID']."JPG\">");}
else
{echo ("");}