Jump to content


Displaying images

  • Please log in to reply
5 replies to this topic

#1 crazy_jayne

  • Members
  • PipPip
  • Member
  • 12 posts

Posted 18 September 2006 - 02:16 PM


I am not a PHP programmer but am tring to use PHP through the Dreamweaver interface. WHich I why I may seem rather stupid.

I would like to display images and this little bit of code works fine when the images are in the same directory as the php file.

<img src="<?php echo $row_Recordset6['Name']; ?>">

However, I don't seem to be able to get my head around the code required to be able view the images if they are in another diectory.

Can someone please help.

Crazy Jayne

#2 wildteen88

  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 18 September 2006 - 02:42 PM

If you want to get image/file from another directory you'll either want to use a relative path or an absolute path

Relative path:
<img src="../other_dir_name/<?php echo $row_Recordset6['Name']; ?>">

The ../ goes up one level from the current working direcotry (where the script is running) and then goes into the other_dir_name directory

Absolute path:
$fullPath = 'http://' . $_SERVER['HOST_NAME' . '/other_dir_name/' . $row_Recordset6['Name'];

echo '<img src="http://' . $fullPath . '">';


Absolute path is where you provide the full path to the file/folder.

#3 crazy_jayne

  • Members
  • PipPip
  • Member
  • 12 posts

Posted 18 September 2006 - 02:59 PM

Thanks for such a quick response.

Up and working now - It's easy when you know how!


#4 weknowtheworld

  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts

Posted 07 January 2007 - 12:56 PM

Recordset6 means?

#5 coffear

  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 08 January 2007 - 02:02 PM

it is just the name they gave to the array which can be anything containing a-z A-Z 0-9 _ as long as it starts with a letter.

The content of the var seems to be an associative array of a row taken from the database.

#6 cyrixware

  • Members
  • PipPipPip
  • Advanced Member
  • 171 posts
  • LocationPhilippines

Posted 17 April 2007 - 05:55 AM

hehehe.. you cannot display images in this source code: <img src="<?php echo $row_Recordset6['Name']; ?>">

wildteen88 is correct. And Recordset6 use for displaying the values or the data in a certain field of your dbase.. :)
XAMPP Control Panel | Wamp 2
<a href="http://www.motion23....o.nr/">Motion23 Technology your business partner</a>
Game kana ba!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users