"") { header("Content-disposition: attachment; filename=$file"); header("Content-Type: application/force-download"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".strlen($temp_str)); header("Pragma: no-cache"); header("Expires: 0"); echo $temp_str; } $result_csv=mysql_query($querystring); $fh=fopen($file,"w+") or die ("unable to open file"); //note that this APPENDS not overwrites while($row=mysql_fetch_assoc($result_csv)): foreach ($row as &$val): $val = str_replace('"', "'", $val); endforeach; fputcsv($fh, $row, ",", '"'); //$temp_str .= '"'.implode('","',$row).'"\n\r'; $t_temp_str = '"'.implode('","',$row).'"'. chr(13) . chr(10); //used for the non file based download endwhile; fclose($fh); } ?> ประกวดผลงานวิชาการ สาธารณสุขจังหวัดศรีสะเกษ