duncan121 Posted December 18, 2006 Share Posted December 18, 2006 I have an interesting challenge.So, I have a simple table displaying files in a directory. These files are waiting to be approved and installed. When they are installed they are entered into the MySQL database.Very straight forward and easy so far. However the directory of files list files waiting to be installed and have been installed.So I want to do a comparison between a directory and a database and ONLY display the items which are not in the database.Once I have got all the files from the directory I am using a simple ignore script and trying to get to include the database values. But it doesn’t work.Please see the code below… Thanks for your help.Duncan//Database call $get_modules2 = new DB(); $get_modules2->query("SELECT * FROM ".DB_PREFIX."_modules"); while ($display_modules2 = $get_modules2->next_record()) { $mods = $display_modules2['name']; } //Directory call $this_dir = dir('modules/'); while ($file = $this_dir->read()) { if($file != '.' && $file != '..' && $file != $mods) { echo $file; } } Link to comment https://forums.phpfreaks.com/topic/31104-dir-mysql-problem/ Share on other sites More sharing options...
tracy Posted December 18, 2006 Share Posted December 18, 2006 Do you need to keep the files in the original location even after they are approved and uploaded into the mysql database? If not, why not delete them at that point or at least move them to another location and rename them...to say filenameOLD.whatever...? For example, one could approve the file and upload to mysql and another function of that same php could be to send an email to whomever stating that the file was uploaded and copied to the 'old' file folder for backup...and deleted from the original location.Would this work? Link to comment https://forums.phpfreaks.com/topic/31104-dir-mysql-problem/#findComment-143640 Share on other sites More sharing options...
duncan121 Posted December 18, 2006 Author Share Posted December 18, 2006 yes they need to remain there.being different users may have the files installed and others not.ThanksDuncan Link to comment https://forums.phpfreaks.com/topic/31104-dir-mysql-problem/#findComment-143643 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.