View Full Version : Backing up a MySQL database by email. Is it possible?

09-25-2003, 09:19 PM
In PHPMyAdmin there is a way you can select all tables in a database and send a text file by email that enables the database and its contents to be reconstructed with SQL.

I would like to do a similar thing using PHP for a database I have designed in MySQL.

I would like a single button which when clicked would send an email to the webmasters email address. The email would contain the SQL code to recreate the database and insert all records.

Is this possible?

Could anyone advise how I could do it?

09-25-2003, 10:01 PM
Possible, yes. As you have phpmyadmin, take a look how that view dumps the data and work around that :) For telling you how it's done, I have no idea as I just let my control panel sort all that out for me

09-25-2003, 10:22 PM
I did try that, but I am fairly new to PHP and I am struggling to follow the code. Just an idea of the functions required might help, then I can research then on the php website.

09-26-2003, 12:01 AM
I'll be downloading phpmyadmin tonight, so I'll see what I can find out from it later on

09-26-2003, 12:09 AM
Just been looking on mysql.com and found this, might be what you're looking for


Do the db query, save results to a file, once saved send off the email with the file as an attachment, then atleast if the email fails, you'll still have the file on your server.