<?php
mysql_connect('localhost','root','admin');
mysql_select_db('body');
mysql_query("set character_set_server='utf8'");
mysql_query("set names 'utf8'");
$result=mysql_query("select * from vendor_group");
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;
}
header('Content-type: text/plain; charset=UTF-8');
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment;filename=list.xls");
header("Content-Transfer-Encoding: binary ");
xlsBOF();
xlsWriteLabel(0,0,"id");
xlsWriteLabel(0,1,"code");
xlsWriteLabel(0,2,"name");
xlsWriteLabel(0,3,"type");
$xlsRow = 1;
while($row=mysql_fetch_array($result))
{
xlsWriteNumber($xlsRow,0,$row['id']);
xlsWriteLabel($xlsRow,1,$row['code']);
xlsWriteLabel($xlsRow,2,$row['name']);
xlsWriteLabel($xlsRow,3,$row['type']);
$xlsRow++;
}
xlsEOF();
?>
to export data from database to excel but the problem is when i export arabic stored data in my database the output in excel sheet doesn't appear

New Topic/Question
This topic is locked


MultiQuote







|