Export MySQL Data as CSV


/ Published in: PHP
Save to your folder(s)

# 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.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.