I want to get every file in a directory except files who's filename matches the value of a mysql table.
Here's what I have so far that just gets everyting in a directory.
$handle=opendir("items/");
$query=mysql_query("SELECT dbitemname FROM table");
$dbitems=mysql_fetch_array($query);
extract($dbitems, EXTR_OVERWRITE);
while (false!==($file=readdir($handle))) {
if ($file!="." and $file!=".." and !$dbitems[$file])) {
// echo or whatever, maybe I might want to add everything from into a database that isn't already there or print the stuff that isn't there to add it selectively, etc
}
}
The problem is the if case. To me that says it should display execute the code if an entry in the array by that name is not present. Instead it just outputs everything and gives me 'undefined index' errors for every entry in the array.
Can anyone tell me what I'm doing wrong?