PHP Script to Save Selected Records from DB to CSV & Zipped

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
diseman
Forum Contributor
Posts: 174
Joined: Mon Jul 26, 2010 1:30 pm
Location: Florida

PHP Script to Save Selected Records from DB to CSV & Zipped

Post by diseman »

Hi All,

I'm looking to find/purchase a script that will:

1. Backup a selected recordset from entire db to .csv file. Will always have a "WHERE id = ";" so file(s) will be rather small.
2. If must be more than one file (i.e. One file for each table) then I would like it to create a folder, save all the files to it, .zip the file, download the file, delete everything in the folder, and then delete the folder.
3. Headers (column names) are required.

I have a script that will backup one table and save it to .csv, but my requirement is for about 8 tables, so don't want to download 8 files to my desktop each time.

If anyone could point me to a script that does this, give me a script, or sell me a script, I would be grateful.

Michael
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PHP Script to Save Selected Records from DB to CSV & Zip

Post by Celauran »

Doesn't seem terribly difficult to write. Check out the Zip library.
Post Reply