View Full Version : I have to add an image from a folder - IMG SRC the database

05-22-2008, 09:08 AM
I have to add an image which is saved in a folder.
The folder and name are specified in the database in the $path field.
I want to not display anything if there is no data in the $path field.
And to display the image if the address is specified in $path.

This code is not working...don't know why...

<img src='<? if (!$path) { } else { echo $path } ?>'>

05-22-2008, 09:14 AM
echo "<img src=\"{$path}\" alt=\"\"/>"; ?

05-22-2008, 10:26 AM
<?php echo trim($path) != '' ? '<img src="'.$path.'" alt="">' : ''; ?>

05-22-2008, 10:39 AM
I got syntax errors because of ".

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum