Reputation: 2577
I want to check if there are any filenames in this folder which are not in the mysql database, but I cant seem to find a way to do this as the loop for fetching the mysql data has to be inside the loop for reading the directory (as far as I can figure),which messes the whole proccess up. Is there another way to do this:
if ($handle = opendir('video/test')) {
while (false !== ($entry = readdir($handle))) {
if ($entry !== "." && $entry !== ".."){
$delfile = "SELECT * FROM files WHERE filename <> '$entry'";
$delfile = $db->query($delfile);
while($row = $delfile->fetch_assoc()){
echo $row['filename'];
}
}
}
closedir($handle);
}
Upvotes: 0
Views: 763