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..

Member Avatar

LastMitch

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.

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

Yes you can do so. I have its script. let me know if you want it :) @vinojai

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;

?>