Exporting data into excel from PHP can done easily without including the Excel classes by using the header command as seen below. Here is the code will show you simple export in excel,
header(“Content-type: application/vnd.ms-excel”);
header(“Content-Disposition: attachment; ame=Report.xls/Report.csv”);
$STATUS = array(‘Blocked/Inactive’, ‘Active’);
echo “<table width=’100%’ border=’0′ cellpadding=’0′ cellspacing=’0′><thead>”;
echo “<tr><td>ID</td><td>Email Address</td><td>URL</td></tr></thead>”;
while($row = mysql_fetch_assoc($result))
{
echo “<tr><td>”.$row['id'].”</td><td>”.$row['email'].”</td><td>”.$row['url'].”</td></tr>”;
}
echo “</tbody></table>”;





younten said,
June 13, 2009 at 6:50 am
nice one… i have been looking for such kind of tutorial
rafeekphp said,
June 16, 2009 at 11:08 am
Hi Younten,
Thanks
Rafeek