prepare($query); $sth->bindValue(":path", $dbpath, PDO::PARAM_STR); $sth->bindValue(":filename", $dbfile, PDO::PARAM_STR); $sth->bindValue(":mtime", $dbmtime, PDO::PARAM_STR); $sth->execute(); } } } walkBooks(); $query = "SELECT id, path, filename FROM books ORDER BY path, filename"; $sth = $globaldbh->prepare($query); $sth->execute(); while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) { $dbbook = $row['path'] . (($row['path'] != "/") ? "/" : "") . $row['filename']; $dbbooks[] = $dbbook; } $query = "DELETE FROM books WHERE CONCAT(path, filename)=:target OR CONCAT(path, '/', filename)=:target"; $sth = $globaldbh->prepare($query); foreach ( $dbbooks as $dbbook ) { if ( !is_file(BOOKDIR . $dbbook) ) { $sth->bindValue(":target", $dbbook, PDO::PARAM_STR); $sth->execute(); } } // vim: set sw=3 ts=3: