qntmfred retired 40726 Posts user info edit post |
i want my webapp to be able to backup/restore individual mysql tables using PHP. ie, user clicks a button, a table is backed up. user clicks another button, table is restored. i could use the code from the phpmyadmin export feature but i'm wondering if there's an easier way. anybody know a good way to do this?
btw, most of the google results end up something like system("mysqldump ..."); and i don't know how i feel about going that route. 7/20/2006 11:22:10 AM |
30thAnnZ Suspended 31803 Posts user info edit post |
V
[Edited on July 20, 2006 at 11:26 AM. Reason : *] 7/20/2006 11:25:50 AM |
spöokyjon ℵ 18617 Posts user info edit post |
It would probably be better to just have a cron job running regularly on the server. 7/20/2006 11:25:59 AM |
qntmfred retired 40726 Posts user info edit post |
well, i'm not trying to do automated backups. i'm trying to do a backup whenever i click the "backup" button 7/20/2006 11:29:03 AM |
qntmfred retired 40726 Posts user info edit post |
the way i do it now uses:
"SELECT * INTO OUTFILE '$backupFile' FROM $tableName"; "LOAD DATA INFILE '$backupFile' INTO TABLE $tableName";
is this good enough or is there a better way that i don't know about?
[Edited on July 20, 2006 at 12:21 PM. Reason : $] 7/20/2006 12:20:59 PM |
sbklein New Recruit 6 Posts user info edit post |
the "mysqldump" thing you can run with a crontab if you have cpanel, otherwise i would just suggest writing something yourself, shouldnt take that long 7/20/2006 1:47:10 PM |