Create one variable and save whole table as string to that variable and just add below headers lines
$header = "Header1" . "\t";
$header .= "Header2" . "\t";
//Reading the data thro' POST
$data= $_POST['header1']. "\t";
$data .= $_POST['header2'] . "\t";
header("Content-Disposition: attachment; filename=xyz.xls");
download sample file
Just at time of installation of opencart on my local iis 7.
I face this error PHP Warning: fopen() : Permission denied in in IIS 7 Continue reading PHP Warning: fopen() Permission denied in in IIS 7
Twitter is an awesome tool for website owners, and you should definitely integrate it into your website if you want to attract more traffic and new visitors. Today, let’s take a look at some PHP snippets to interact with Twitter.
The example code below uses the raw mysql_* functions but it should be easy enough to substitute a database library’s functions instead. It also writes the data out line by line to the CSV file whereas you could buffer the whole file in memory and write it out at one go; however if the resultset is large it may be better to write it out line by line so as not to consume too much memory.
The $server, $login, $password, $db and $table variables should be obvious in their purpose 🙂 Continue reading Create a CSV file from MySQL with PHP
The headers look like so, substituting filename.csv for the name you would like:
header('Content-Disposition: attachment; filename="filename.csv"'); Continue reading Sending a CSV file to the web browser with PHP