Click to See Complete Forum and Search --> : Export to Ms-excel using php


raj_2006
05-15-2006, 02:07 AM
Hi all,

I have the tables ready with the data already fetched from mysql.But i need to export the table-data into ms-excel using php.

Really i have no idea about from where to start and with what i should start.But i heard it can be done.....
Can you plz suggest me from where i can get idea about how to export the data into excel sheet.

Thanks in advance for your earnest co-operation.

Luv....Raj

raaam
05-15-2006, 02:38 AM
hi,

just see this code...

<?
header("Content-type: application/x-ms-download");
header("Content-Disposition: attachment; filename=newdowload.xls");

echo "number\tname";
for($i=0;$i<$urRowCount;$i++)
{
$number = fromRecordSet[number];
$name = fromRecordSet[name];

echo $number."\t".$name."\n";
}

?>


i think this is enough 2 u


bye

porky
05-15-2006, 02:50 AM
you can export the data to CSV file, then open it in MS Excell

raj_2006
05-15-2006, 09:47 AM
Hello Raam,

Its working.Thanks for your earnest help.I just changed the for loop into my requirements.

Thanks again to both of you for your co-operation.

Luv....Raj