I have this code which checks if there are any filenames in my database table “files” which are not in the directory “video/test”. I have been trying to edit this code so that it does the opposite i.e it checks if there are any filenames in the directory “video/test” which are not in the database table “files”. I am having some trouble switching the content to the other side of the clause. I’m getting mysql syntax errors. Can anyone help me out with this
$filenames = scandir("video/test");
$sql = sprintf( 'SELECT * FROM files WHERE filename not in ("%s")', implode( '","', $filenames ) );
Something like this:
Give it a try 😉
Saludos.