...

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



niko-cola
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 } ?>'>

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

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum