Re: Sweet PHP backup / dump function for MySQL database
| From: | CPT John W. Holmes | Date: | Tue, 04 Nov 2003 18:40:28 +0000 |
| Subject: | Re: Sweet PHP backup / dump function for MySQL database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168495@lists.php.net to get a copy of this message | ||
From: "René Fournier" <m5@renefournier.com>
> Right now, I'm using phpMyAdmin to periodically backup/dump a client
> MySQL database to a textfile (from which one can simply restore the
> database if it ever got corrupted). I'm also working on a super-simple
> CMS for the client to use themselves. I would like the client to also
> be able to easily "backup" his web site's MySQL database to a textfile
> and have that textfile emailed to whatever address he specifies. Sort
> of a two step approach:
>
> Enter email _________
> < Backup and send database > (click)
>
> I imagine someone somewhere has written a very nice function for doing
> this, which might take a few parameters, such as database, destination
> email address, etc. The main thing is that the function include
> complete inserts, extended inserts, backquotes, etc.
>
> Anyone have a sweet function like this they wanna share, and in so
> doing make the world a better place? :-)
Easiest way to do this is an exec() call to mysqldump, then read the file
and include/attach it in the email.
Writing something to simulate mysqldump from within PHP would be a waste,
imo.
---John Holmes...