tangolik Posted October 11, 2007 Share Posted October 11, 2007 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 https://forums.phpfreaks.com/topic/72827-how-to-point-the-path-to-image-folder-for-mysql-php-database/ Share on other sites More sharing options...
trq Posted October 11, 2007 Share Posted October 11, 2007 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 https://forums.phpfreaks.com/topic/72827-how-to-point-the-path-to-image-folder-for-mysql-php-database/#findComment-367273 Share on other sites More sharing options...
tangolik Posted October 11, 2007 Author Share Posted October 11, 2007 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 https://forums.phpfreaks.com/topic/72827-how-to-point-the-path-to-image-folder-for-mysql-php-database/#findComment-367321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.