0

I have generated N number of files by exporting data from mysql using php. Now is it possible to add those generated files in zip and download them?

  • 1
    Yes, it's perfectly possible.... using [PHP's ZipArchive](http://php.net/manual/en/class.ziparchive.php) – Mark Baker Jun 05 '16 at 12:06
  • files generated are same as the table name but i am still unable to get the `foreach()` & it is showing as **Parse error: syntax error, unexpected 'foreach' (T_FOREACH)** here is a part of the code that i have written `while ($rows1 = mysql_fetch_assoc($result1)) { $commaList = implode (',', $rows1); $list1= "'".$commaList.".dat'"; $zip = new ZipArchive(); $zip_name = "filezip.zip"; // Zip name $zip->open($zip_name, ZipArchive::CREATE); foreach ($list1 as $file) { echo $list1; $zip->addFile($file); } $zip->close();` – Kable Redfield Jun 05 '16 at 12:19

0 Answers0