queryDirect("select releases.searchname, releases.postdate, uncompress(release_nfos.nfo) as nfo from releases inner join release_nfos on releases.ID = release_nfos.releaseID and release_nfos.nfo is not null order by postdate"); while ($row = $db->getAssocArray($res)) { $dir = date("Ymd", strtotime($row["postdate"])); if (!file_exists($dir)) mkdir($dir); $filename = $dir."/".safeFilename($row["searchname"]).".nfo"; if (!file_exists($filename)) { $fh = fopen($filename, 'w'); fwrite($fh, Utility::cp437toUTF($row["nfo"])); fclose($fh); } }