It is necessary to output the names of directories that are not in the database, I found the code that, in theory, should do this, but it displays just stupidly those directories that are clogged in the database
$result = mysqli_query($connection,"SELECT id_galery FROM albums"); $dir = opendir (PATH_ROOT."img/gal/big/"); echo "Files:\n"; while ($file = readdir ($dir)) { while ($myrow = mysqli_fetch_array ($result)) { if($file!=$myrow["id_galery"]) { echo "<br>".$myrow["id_galery"]."_____Файла НЕТ в базе"; } } } closedir ($dir);
mysql_fetch_array(), in theory, should be rendered from cycles. and in a nested loop, it is necessary to iterate over the values in the array obtained by this function: if the value matches, then terminate the cycle, and if the array is over, and no match is found, output the message. You can find out if the array has ended, or the cycle has been interrupted, by using the flag variable. - aleksandr barakin