|
-
February 16th, 2009, 02:36 AM
#1
PHP to EXCEL
im using php and mysql
can anyone help me on using this program
PHP Code:
<?php $line1="ID\tProduct\tColor\tSales\t"; $line2="1\tPrinter\tGrey\t13\t"; $line3="2\tCD\tBlue\t15\t"; $line4="3\tDVD\tRed\t7\t"; $line5="4\tMonitor\tGreen\t4\t"; $line6="5\tTelephone\tBlack\t2\t";
$data="$line1\n$line2\n$line3\n$line4\n$line5\n$line6\n"; header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=extraction.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; ?>
i got this in the net and i want to edit it depending on my format
how can i change this part on my own variable coming from my database?
$line1="ID\tProduct\tColor\tSales\t";
$line2="1\tPrinter\tGrey\t13\t";
$line3="2\tCD\tBlue\t15\t";
$line4="3\tDVD\tRed\t7\t";
$line5="4\tMonitor\tGreen\t4\t";
$line6="5\tTelephone\tBlack\t2\t";
instead of this i want to use this for ex.
$line1="ID\tProduct\tColor\tSales\t";
$line2="1\t$product\t$color\t$sales\t";
i have a list of records with different columns and below the records i put a button save to spreadsheet. i want that whatever is in the list, it should be on the excel when i transport it.
help
tnx
Last edited by ryanbong; February 16th, 2009 at 02:40 AM.
Reason: added tags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|