<br /><br /> <?php $file = new File(); $fileList = $file->listFilesInDir(APP_XML_PATH); foreach ($fileList as $file) { echo '<a href="data/xml/' . $file . '">' . $file . '</a><br />'; } if (isset($_POST['submit'])) { $file = new File(); $file->setFilePath(APP_XML_PATH . date("FY", strtotime("-1 month")) . '.xml'); if (!$file->fileExists() || $file->fileIsEmpty()) { $file->appendFile('<file>'); } else { if ($file->fileExists() || !$file->fileIsEmpty()) { $fileLines = $file->getFileLines(); $file->emptyFile(); foreach ($fileLines as $line) { if ($line != '</file>') { $file->appendFile($line); } } } } $file->appendFile("\t" . '<bestellingen genereerdatum="' . date("d-m-Y H:i:s") . '">'); $queryA = mysql_query("SELECT * FROM bestelling WHERE Datum >= '" . date("Y-m-01", strtotime("-1 month")) . "'"); while ($fetch = mysql_fetch_assoc($queryA)) { $file->appendFile("\t\t" . '<bestelling BestellingID="' . $fetch['BestellingID'] . '" GebruikerID="' . $fetch['GebruikerID'] . '" Datum="' . $fetch['Datum'] . '" Totaalprijs="' . $fetch['Totaalprijs'] . '">'); $queryB = mysql_query('SELECT BesteldProductID, Aantal, Verkoopprijs, Totaalprijs FROM besteldproduct WHERE BestellingID = ' . $fetch['BestellingID']); while ($row = mysql_fetch_assoc($queryB)) { $file->appendFile("\t\t\t" . '<besteldproduct ProductID="' . $row['BesteldProductID'] . '" Aantal="' . $row['Aantal'] . '" Verkoopprijs="' . $row['Verkoopprijs'] . '" Totaalprijs="' . $row['Totaalprijs'] . '" />'); }