Help - Search - Members - Calendar
Full Version: database backup help
Get Paid Forum - Get Paid Discussion > Webmaster's Corner > General Discussion on Building, Running & Making Money from a Website
fernyburn
Hi,
This is a bit off subject.....

I have a programmer currently working on a script for me.
In this script I need to add a link to download my database,

If you have any type of program that has a control panel, where you simply have a 'download database' button, which then just gives you a save as dialog box, and lets you download all your database tables into your harddrive.

I need it to be on a php script, accessing the mysql database tables as a dump.
Im sure all you gptr ect webmasters have such a feature installed.

What i need is a demo of it. I have spent 3 days explaining to my programmer how it should work, but to no avail. and Im now near screaming point.

If there are any working demos out there please let me know, so at least i can show my programmer, what i want.

anything will do, I just need an example.
Thanks in advance for your help
freeandeasy
Ask your programmer if this helps.
If it's not enough, I have more. But I'm not very techy so I have to make intelligent (I hope) guesses about which parts of the script does what.



CODE
<?
set_time_limit(0);
include("../config.inc.php");
if (!$mysqldumppath){
$mysqldumppath="/usr/local/bin/";}
if (!$gzippath){
$gzippath='/usr/bin/';}
    $cur_time=date("Y-m-d H:i");
header("Content-disposition: filename=$mysql_database.sql.gz");
                                       header("Content-type: application/octetstream");
                                       header("Pragma: no-cache");
                                       header("Expires: 0");
passthru("$mysqldumppath./mysqldump -h$mysql_hostname -u$mysql_user -p$mysql_password $mysql_database | $gzippath./gzip -f")
    
?>
top-designing
Any mysql server has some export functions, if you have a mysql client just export the tables and contents and take a look what code has generates.
Then replace the parameters.
Or even you can use the phpmyadmin to see how it works. You will find all the sources, just make a search though google.
There you will find the full code.
ReDucTor
I use phpMyAdmin's Export function or mysqldump..
fernyburn
Hi Guys
thanks for your replys.
Unfortunatly It hasnt helped much.
I was hoping there may have been an online demo of a script, that a button gets clicked and the database gets dumped. but I cant find one any here.

Cheers anyways
3a3
QUOTE (fernyburn @ Feb 25 2003, 11:09 AM)
Hi Guys
thanks for your replys.
Unfortunatly It hasnt helped much.
I was hoping there may have been an online demo of a script, that a button gets clicked and the database gets dumped. but I cant find one any here.

Cheers anyways

I guess the code snippet that freeandeasy posted is just the thing you're looking for .. give it to your programmer .. and if he's intelligent enough, he'll know what to do with it.

of course there might arise some problems with running PHP in Safe Mode, but .. that's already another question ..

by the way, the snippet still needs some editing .. like changing the password, file path or something .. that depends on your hosting .. and if it's a windows one .. then .. I guess gZIP will not work ..

I must say .. you are looking for a simple solution to a rather complex problem .. ac.gif
fernyburn
yep, i handed over the code,
Though the solution is to get someone else to do it....

They have managed to make a backup work, but they have done it as putting the database onto the server, as a text file, then downloading it from there.........

why they cant just use the above script to dump staright onto the hard drive is beyond me...... but Some people do the strangest things ao.gif

Thanks again
3a3
QUOTE (fernyburn @ Feb 26 2003, 01:02 AM)
why they cant just use the above script to dump staright onto the hard drive is beyond me...... but Some people do the strangest things ao.gif

lol .. ask that to your programmers, not us .. ab.gif ad.gif ae.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.