Jump to content

Whats wrong with this code


Recommended Posts

Hi there,

 

I am developing a content management system, and I have some details stored in a mysql database. I am trying to retrieve an image whose path is stored in the database.

 

I obtained the path using the following:

 

$uploadDir = $_SERVER['DOCUMENT_ROOT'] .  "/images/portfolio/";

 

and after retrieving the details from the database, I am trying to display it using the below as part of a table:

 

echo "<td rowspan=\"3\"><img src=\" ".$content . "\"/></td>";

 

but the image is not showing. I would appreciate it if someone could point me in the right direction as I have been staring at this for the past 30 minutes without a clue.. :(

 

Thanks

 

Link to comment
Share on other sites

I don't think you want to use DOCUMENT_ROOT. That will return the local path. I assume you want the path to the images to be accessible to people on the Internet, which this won't be.

 

Do you want the result to be http://mysite.com/images or c:\inetpub\wwwroot\images (windows) or /www/mysite/images (unix)?

 

There's a way to get the path, but I can't think of it right now.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.