I have data in a MySQL database. I am sending the user a URL to get their data out as a CSV file.
I have the e-mailing of the link, MySQL query, etc. covered.
<
Already very good solution came. I'm just puting the total code so that a newbie get total help
$value) {
//there may be separator (here I have used comma) inside data. So need to put double quote around such data.
if(strpos($value, ',') !== false || strpos($value, '"') !== false || strpos($value, "\n") !== false) {
$row[$key] = '"' . str_replace('"', '""', $value) . '"';
}
}
echo implode(",", $row)."\n";
}
?>
I have saved this code in csv-download.php
Now see how I have used this data to download csv file
So when I have clicked the link it download the file without taking me to csv-download.php page on browser.