Converting HTML to Excel in php 2011View more random threads:
- Php Transaction 2011
- waht is mean by lenght of strings" what is its use in...
- what are the latest updates for Mysql May 2011
- php and mysql lectures online in Pakistan for free 2011
- PHP include instead of iFrame 2011
- Difference between mysql and mysqli 2011
- Students should share php and mysql knowledge with each...
- Converting HTML to Excel in php 2011
- Hyperlinking in Php?
- what is factorial language?
Sponsored Links
Code:<script type="text/javascript"> <!-- var currentTime = new Date() var month = currentTime.getMonth() + 1 var day = currentTime.getDate() var year = currentTime.getFullYear() //--> </script> <?php include('ADC_project_excel1.php'); $result = mysql_query("SELECT * FROM NewProject"); $count = mysql_num_fields($result); for ($i = 0; $i < $count; $i++){ $header .= mysql_field_name($result, $i)."\t"; } while($row = mysql_fetch_row($result)){ $line = ''; foreach($row as $value){ if(!isset($value) || $value == ""){ $value = "\t"; }else{ $value = str_replace('"', '""', $value); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim($line)."\n"; } $data = str_replace("\r", "", $data); if ($data == "") { $data = "\nno matching records found\n"; } //header("Content-Type: application/vnd.ms-excel; name='excel'"); header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=excelfile.xls"); header("Pragma: no-cache"); header("Expires: 0"); echo $header."\n".$data; //print "done"; ?>
There are currently 1 users browsing this thread. (0 members and 1 guests)