hi
this is a code for export to excel.
I want to color the headers light blue and all result of query like one white then one grey and repeat.
session_start();
$a= $_GET["id"];
function cleanData(&$str)
{
$str = preg_replace("/\t/", "\\t", $str);
$str = preg_replace("/\r?\n/", "\\n", $str);
}
# file name for download
$filename = "EIMS_Finance" . date('Y-m-d') . ".xls";
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type:application/vnd.ms-excel");
$flag = false;
$qry1=mysql_query("(SELECT * from Table where Id=$a");
while(false !== ($r1=mysql_fetch_assoc($qry1)))
{
if(!$flag) {
# display field/column names as first row
echo implode("\t", array_keys($r1)) . "\n";
$flag = true;
}
array_walk($r1, 'cleanData');
echo implode("\t", array_values($r1))."\n" ;
}
?>
GINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;