Hi, this is my first time here.
i am trying to create an xls file from the data i get from mysql. here is the code i tried but i am not able to use it correctly.
ob_start();
include('config');
$datacat = mysql_query("SELECT *
FROM `leads`") or die(mysql_error());
$name = mysql_fetch_assoc($datacat);
$line1="Industry,Company Name,Officials Name,Job Title,Country,Direct Number Mobile Number,Switch Board Number,E-mail,Executive NamePitch Date,Call Back Date,Comments\t";
while($row = mysql_fetch_array($datacat, MYSQL_ASSOC)) {
$line2= $name['industry'].",".$name['company_name'].",".$name['officials_name'].",".$name['job_title'].",".$name['country'].",".$name['direct_number_mobile_number'].",".$name['switch_board_number'].",".$name['email'].",".$name['executive_name'].",".$name['pitch_date'].",".$name['call_back_date'].",".$name['comment']."\t"."\n";
}
$data="$line1\n$line2\n";
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=extraction.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";
i get my webpage title in the top of xls file and all the fields in xls file are separated by commas, whereas i want them to be in proper tables.
Help would be much appreciated.