Czy spotkal sie ktos z problemem wysylania naglowkow w petli?
W moim przypadku chodzi o download kilku plikow z bazy MySQL.
Jezeli zrobie to w petli, dziala tylko raz. Dla jednego naglowka. Potem wychodzi calkowicie ze skryptu.
Jak ten problem rozwiazac?
<?php
foreach ($keyarray as $key => $value) {
if (strstr($key,'item_number')!=FALSE) {
$dbQuery = "SELECT * FROM micropayments WHERE id = '$value' ";
$fileContent = $row['pdf'];
$fileTitle = $row['title'].".pdf";
if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) { // IE Bug in download name workaround
ini_set( 'zlib.output_compression','Off' ); }
header("Cache-Control: public"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-type: application/pdf"); header('Content-Disposition: attachment; filename="' . $fileTitle . '"'); header("Content-Transfer-Encoding: binary");
}
} else echo "Record doesn't exist.";
}
}
?>