Code isn't displaying the image

I’m trying to figure out why one of our sites won’t display it’s images here is the code that was written by a previous employee:

[code]<?php
if (empty($results)) {
?>


Sorry, no results!

<?php
}
else {
foreach ($results as $row) {
print “”;
print “”;
if ($row[‘imagefilename’]) {
print ‘’;
}
else {
print “No image available”;
}
print “ ”;
printf(’%s’, $row[‘id’], $row[‘name’]);
if ($row[‘description’]) {
print ‘

’ . $row[‘description’] . ‘

’;
}
print “”;
print “”;
print “n”;
print ‘
’ . “n”;
}
}
?>

[/code]
Which always outputs “No image Available”
https://ssl.perfora.net/animalearn.org/ … cebank.php

So I messed around a little bit, I got it to display the image but the way I have it I’d have to go in and rename all of the images, not really a big deal but something I prefer not to do. I also am unsure of to make it print “No Image Available” when there actually isn’t an image available.

[code]<?php
}
else {
foreach ($results as $row) {
print “

”;
print “”;
/TEST CODE/
/* print ‘’;*/
					  printf( '<a href="view_sciencebank_item.php?id=%s"><img src="sciencebankimages/%s.jpg" width="50" border="0"/></a>', $row['id'], $row['id']);
					  
					  /*if ($row['image_filename']) {
					  	print '<a href="view_sciencebank_item.php?id=' . $row['id'] . '"><img src="sciencebankimages/' . $row['image_filename'] . '" width="50" border="0"/></a>';
					  }
					  else {
					  	print "No image available";
					  }*/
					print "</td><td>";
					printf('<a href="view_sciencebank_item.php?id=%d">%s</a>', $row['id'], $row['name']);
					if ($row['description']) {
						print '<p class="item_description">' . $row['description'] . '</p>';
					}
					print "</td>";
					print "</tr>";
					print "n";
					print '<tr><td colspan="2"><hr></td></td>' . "n";
				}
			}
  ?>[/code]

https://ssl.perfora.net/animalearn.org/ … k-test.php

Any help would be greatly appreciated.

ADMIN EDIT: Added CODE tags for Readability

it appears that nothing is being brought back out of the database for imagefilename.

Sponsor our Newsletter | Privacy Policy | Terms of Service