0

Hi

I did one php application.
In that application on clicking the download button.The datas from database have to convert into excel sheet and download.
Can anyone please help me to do..

Edited by vinojai

6
Contributors
5
Replies
33
Views
3 Years
Discussion Span
Last Post by layman114
2

In that application on clicking the download button.The datas from database have to convert into excel sheet and download.

@vinojai

Can you please post your code?

It's a bit hard to follow how you convert excel sheets by clicking a download button.

0

How to connect MYSQL Data base on a webserver with a PHP Script or page?

0

Hai;

Chek this link http://code.google.com/p/php-excel/source/browse/branches/class-excel-xml.inc.php?r=9

Use class Excel_XML and include this class in your donmload link page.

Example for download ling page:

<?php
include_once("model/excel.php");//includeind class Excel_XML

//get data from database
include_once("model/user.php");
$user   =   new User();
$getAllUsres  = $user->getOtherUsers();

//set the data base result in to a variable         
            $table='<table id="ReportTable" width="900" cellpadding="2" cellspacing="2" class="myClass" border="1">
    <tr><th>Frist Name</th><th>Last Name</th><th>Email</th><th>City</th><th>Address</th></tr>';

      foreach($getAllUsres  as $myReg) {
            $table.='<tr><td><center>'.$myReg->FirstName.'</center></td><td><center>'.$myReg->LastName.'</center></td><td><center>'.$myReg->Email.'</center></td><td><center>'.$myReg->City.'</center></td><td><center>'.nl2br($myReg->AddressOne).'</center></td></tr>';   
      }

      $table.='</table>';
      header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=quiwed-users.xls');

header("Pragma: public");
header("Cache-Control: ");
echo $table;

?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.