Jump to content

help with mysql and creating link to images


blagojkk

Recommended Posts

I have one table in the mysql database. I want to setup a field that links to an image on my server so I need someone to tell me how to set up the field and make the link entry? After that I heed to display that image using this link in a web browser with some PHP form.

For examle my databse name is 'imagedb', my table name is 'imagetbl' and my field name is fieldimg'. My image is in /var/www/html/images/image1.jpg.

Thanks
Link to comment
Share on other sites

Well don't link to the local filesystem. You need to link either relative to the current directory or the root of your webserver. I'd probably only store the actual file name if they are all going to be in images/
[code]
if($row['fieldimg']) {
    $img = "<img src='/images/$row[fieldimg]'>";
}
   
}[/code]
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.