I am trying to export the data from PHP & MySql. I am getting Empty value for Fields which are having huge data(around 1000 chars). Except those fields everything is working fine. This is the code which i am using right now. Please check once and let me know if any modifications. I searched in google, so many said its cache/memory problem.
<?php
function xlsBOF() {
echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
return;
}
function xlsEOF() {
echo pack("ss", 0x0A, 0x00);
return;
}
function xlsWriteNumber($Row, $Col, $Value) {
echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);
echo pack("d", $Value);
return;
}
function xlsWriteLabel($Row, $Col, $Value ) {
$L = strlen($Value);
echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
echo $Value;
return;
}
$sel_sql=mysql_query("select desc from table");
$myFile = date("m-d-Y").'_users.xls';
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-type: application/vnd.ms-excel");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=".$myFile);
header("Content-Transfer-Encoding: binary ");
// XLS Data Cell
xlsBOF();
xlsWriteLabel(0,1,"desc");
$xlsRow = 1;
while(list($desc)=mysql_fetch_row($sel_sql)) {
xlsWriteLabel($xlsRow,1,"$desc");
$xlsRow++;
}
xlsEOF();
?>