PDA

View Full Version : Simple PHP question ...


Reflex
01-27-2005, 09:09 AM
Here is a line from my .php file:

echo " ".$row['picFile'].": ".$row['caption']."<br><br>";


The picFile will be something like myPicture.gif and relative to the .php it will be located at images/myPicture.gif

So how do I convert the above .php script so that it will display the image like the following html would:

<img src="images/myPicture.gif">


Maybe something like (which doesn't work but might show clearer what I am trying to do):

echo " <img src=\"images\"+".$row['picFile'].": ".$row['caption']."<br><br>";


Thanks,
Stephen.

Laguana
01-27-2005, 09:30 AM
I'm not sure what the caption is exactly, but when you echo things it's interpreted as html, so this should work:


echo "<img src='images/".$row['picFile']."'>"

If $row['picFile'] had myPicture.jpg, that would read

<img src='images/myPicture.jpg'>

which should get you a picture. You can of course include the line breaks, and you can put the caption thing in somewhere too... but that's all subjective.

Hope it helps.

Reflex
01-27-2005, 12:04 PM
thanks :)