incremented database counter for new global setting in prior commit
[openemr.git] / interface / batchcom / batchCSV.php
blobf5109c4536c1763b6ca2be7bf32f3685dba54821
1 <?php
2 /*
3 batch CSV processor, included from batchcom
4 */
6 // create file header.
7 // menu for fields could be added in the future
9 while ($row=sqlFetchArray($res)) {
11 if (!$flag_on) {
12 $flag_on=TRUE;
13 foreach ($row as $key => $value ){
14 $file.="$key,";
16 $file=substr($file,0,-1);
17 $file.="\n";
18 reset ($row);
21 foreach ($row as $key => $value) {
22 $line.="$value,";
24 $line=substr($line,0,-1);
25 $line.="\n";
26 $file.=$line;
27 $line='';
31 //download
32 $today=date('Y-m-d:H:i:s');
33 $filename="CSVdata-".$today.".csv";
34 header('Pragma: private');
35 header('Cache-control: private, must-revalidate');
36 header("Content-type: text/comma-separated-values");
37 header("Content-Disposition: attachment; filename=".$filename);
38 print $file;
39 exit()