Jump to content

how to point the path to IMAGE folder for MYSQL PHP database


tangolik

Recommended Posts

Hi all,

 

in my website there are ftp-uploaded images (about 3000) in a folder called IMAGE. What I want to do is somehow get the image file names inserted in to my database so, I can see image file names in a pull down menu selection when I insert records through FORM on a php file.

 

i use MYSQL PHP LINUX configuration.

 

 

if someone can help that would be great.

 

thank you

 

ps. I also placed this question in MYQSL section. If I am wrong doing so, please point the way I am supposed to be. thank you

Link to comment
Share on other sites

What part are you stuck on exactly? its a pretty simple idea.

 

<?php

  // connect to db.

  $dir = glob('images/*.jpg');
  foreach ($dir as $file) {
    $sql = "INSERT INTO tbl (imagepath) VALUES ('images/$file');"
    if (mysql_query($sql)) {
      echo "images/$file added to db.<br />";
    }
  }

?>

Link to comment
Share on other sites

Hi, thank you for your quick answer.

 

this could work, but i am so very new to this. I am using Dreamweaver.

 

tell you to truth i don't know how to connect your code to any page.

 

do i need a record set to connect with? if you can elaborate this i would appreciate it

 

thank you

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.