Any clue on fixing this? The recordset does exist
<?php
//Export to Excel Server Behavior
if (isset($_GET['Export'])&&($_GET['Export']=="Export Spreadsheet")){
$delim="";
$delim_replace="";
if($delim==""){
$lang=(strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'],",")===false)?$_SERVER['HTTP_ACCEPT_LANGUAGE']:substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'],","));
$semi_array=array("af","zh-hk","zh-mo","zh-cn","zh-sg","zh-tw","fr-ch","de-li","de-ch","it-ch","ja","ko","es-do","es-sv","es-gt","es-hn","es-mx","es-ni","es-pa","es-pe","es-pr","sw");
$delim=(in_array($lang,$semi_array) || substr_count($lang,"en")>0)?",":";";
}
$output="";
$output="1 = RecruitSavvy 2 = CareerSoft 3 = Warm Calling 4 = Unclaimed Property that 5 = Resume Search Only 6 = Career Changers 7 = Brokerage\n\n";
$include_hdr="1";
if($include_hdr=="1"){
$totalColumns_WADAcustomers=mysql_num_fields($WADAcustomers);
for ($x=0; $x<$totalColumns_WADAcustomers; $x++) {
if($x==$totalColumns_WADAcustomers-1){$comma="";}else{$comma=$delim;}
$output = $output.(ereg_replace("_", " ",mysql_field_name($WADAcustomers, $x))).$comma;
}
$output = $output."\r\n";
}
do{$fixcomma=array();
foreach($row_WADAcustomers as $r){array_push($fixcomma,ereg_replace($delim,$delim_replace,$r));}
$line = join($delim,$fixcomma);
$line=ereg_replace("\r\n", " ",$line);
$line = "$line\n";
$output=$output.$line;}while($row_WADAcustomers = mysql_fetch_assoc($WADAcustomers));
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=client_report.csv");
header("Content-Type: application/force-download");
header("Cache-Control: post-check=0, pre-check=0", false);
echo $output;
die();
}
?>