Forum Moderators: coopster

Message Too Old, No Replies

Export mysql data to .xls format

         

compose

8:57 am on Oct 11, 2005 (gmt 0)

10+ Year Member



Hi,

Can any body tell me how to convert mysql data to excel format using php.

Thanx

Vineet

omoutop

9:02 am on Oct 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi!this one queries the DB, get the e-mails and exports them into an excel file. take a look
///////////////////////////////
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename={$destination}.xls");
header("Content-Transfer-Encoding: BINARY");
include "dbconnect.php";
?>
<table>

<?
$url2 = "select distinct(Email) as Email from reservations where Island='$destination' order by Email";
$resulturl2 = mysql_query($url2);
while ($resurl2=mysql_fetch_assoc($resulturl2))
{
$email = $resurl2['Email'];
?>
<tr>
<? echo $email?>
</tr>
<?
}
?>//////////////////////////////////////

compose

9:33 am on Oct 11, 2005 (gmt 0)

10+ Year Member



Thanx for ur reply.

I understand it..