/ Published in: PHP
# Export MySQL Data as CSV
This code takes a `mysql_query()` resource and outputs its rows into CSV spreadsheet format. Edit the `header('Content-Disposition...` declaration to tell the user's browser to either display the data as plain text or download it as an `attachment`.
__Note:__ This doesn't include the code to connect to the database in the first place. Don't forget that, otherwise this code is pretty useless.
This code takes a `mysql_query()` resource and outputs its rows into CSV spreadsheet format. Edit the `header('Content-Disposition...` declaration to tell the user's browser to either display the data as plain text or download it as an `attachment`.
__Note:__ This doesn't include the code to connect to the database in the first place. Don't forget that, otherwise this code is pretty useless.