In my system, I have fetching all data and exporting in txt file.
$str_res_exp = $this->export_res($column ,$res_data,$column_length);
header("Content-type: plain/text");
header("Content-Disposition: attachment; filename=".$_POST['txt_name'].".txt");
header("Pragma: no-cache");
header("Expires: 0");
echo $str_res_exp;
exit;
it displays data but but on first line, first character it fills white space...
due to security reason i cant post more code.