I have a database which is tied to a server of pictures. In the case that a pic isn't uploaded I want to place an "unavailable" photo in its place. Each pic is in numerical order based on the primary key from the database $row['Item_ID']
. My script below searches for the file but can't find any pics, so it uses the "unavailable" for everything. I am not sure if I can use double quotes on the first line when I write '$row["Item_ID"]'
.
$img_var = '$row["Item_ID"]';
$item_img = '/item_images/$img_var.jpg';
if (!file_exists($item_img))
{ $row['Item_ID'] = 'unavailable'; }
else { $row['Item_ID'] = $row['Item_ID']; }