tags:

views:

28

answers:

3
+1  A: 

Change this line:

$backupdir = 'C:\wampbackup\x.sql'; 

into:

$backupdir = 'C:\\wampbackup\\x.sql'; 

You need to escape back-slashes with another \ back-slash. :)

Sarfraz
still not working after following your advice. Where would the backup suppose to go?
it will be saved in C:\wampbackup\x.sql. Make sure that you have write permission for the folder C:\wampbackup
Sarfraz
+1  A: 

You should actually post your error message along with your code. But if it is not a copy-paste error, I found your bug: It's on line 4, the closing apostrophe is missing

$db=   'hospital;
soulmerge
A: 

As a minor aside, you could skip the entirety of

if ($day < 10) { 
    $day = "0$day"; 
}

Later on you're using those values in a sprintf() call, which can do such formatting automatically. Simply change the matching %s with %02d (print a decimal padded to 2 spaces with the 0 character).

Marc B