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.
Put in the $output variable the CSV data and echo with the correct headers
$output
header("Content-type: application/download\r\n"); header("Content-disposition: filename=filename.csv\r\n\r\n"); header("Content-Transfer-Encoding: ASCII\r\n"); header("Content-length: ".strlen($output)."\r\n"); echo $output;