This standalone PHP file runs a MySQL query. Then sends the results in an email as a CSV (comma separated values) file attachment. This CSV file is properly formatted so it can be opened by OpenOffice.org Calc, or Microsoft Excel.
Copyright © 2009 Stephen R. Owens
This software is licensed under the GNU GPL version 3.0.
I created this code as a standalone PHP file that can be run by opening it in a web browser, or running it from a Cron Job. The source code in this PHP file is well commented and can be modified to fit your needs. The GNU GPL license gives you the room to adapt it to your project.
What it does:
Some example of how others have used this file include:
A web server with PHP and a MySQL database.
You will need to know how to:
Step 1: Add your Server Information, and Personal Settings, to the Source Code
The source code is well documented and you will be able to figure out what to enter, and where to enter it, by following these directions:
Step 2: Upload the file to Your Web Sever
After you fill in your specific details, upload the file email-query-results-as-csv-file.php to your web server.
Setp 3: Run the File from a Web Browser
Run the file email-query-results-as-csv-file.php from a web browser. It will output messages of success or error at each step.
If you have questions on using this tool, or have a comment, you can contact me or post a message into the comments section below.
If you need helping modifying this file for a particular purpose, or integrating it with another PHP program, and you don't have the coding skills, I will code for money. Contact me for a quote.
2009-NOV-11: v1.0
* Initial Public Release
Copyright © 2001 - 2010, Stephen R. Owens, All rights reserved.
Comments for "Email a MySQL Query Results as a CSV File Attachment"
Grazie
Leave a Comment