Jump to content

help with mysql and creating link to images


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.

Link to post
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/
if($row['fieldimg']) {
    $img = "<img src='/images/$row[fieldimg]'>";
Link to post
Share on other sites


This topic is now archived and is closed to further replies.

  • 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.