What is wrong with this echo ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Leftfield
Forum Newbie
Posts: 1
Joined: Sun Feb 06, 2011 6:30 am

What is wrong with this echo ??

Post by Leftfield »

Hi..
What is wrong with this

Code: Select all

echo '<br/><br/> <img src="images/rooms/$row[ImageUrl]" border=0>';//I want to display the imageurl but the url is wrong 
How to ecscape to show vairable instread of $row img url ....
divedj
Forum Commoner
Posts: 47
Joined: Wed Dec 29, 2010 4:32 am
Location: Malta

Re: What is wrong with this echo ??

Post by divedj »

There are a couple of ways to do this. If you are still in php this one works:

Code: Select all

<?php
    echo "<br/><br/> <img src=\"images/rooms/".$row[ImageUrl]."\" border=0>";
?>
To make html formating easier you could also do this:

Code: Select all

   <?php
        // some php code here
   ?>
   <br/><br/>
   <img src="images/rooms/<?php echo $row[ImageUrl]; ?>" border=0>
Check the file folder from which you are calling your image url. If it is in a different directory you might have to use the following to get to your image url:

"../images/........
or
/images/rooms/.....
Post Reply