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

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 />";
    }
  }

?>

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

Archived

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.