Jump to content

Making a database backup help


Imad

Recommended Posts

Hi guys, I'm trying to create this database backup script but it isn't working.  >:(

 

Here's the code:

 

// Database backup system
$settime = date(_mdys);
$namer = "$dbname$settime.txt";
$backupdoc = "inc/backup/$namer";

$query = "SELECT * INTO OUTFILE '$backupdoc' FROM comments";
if (mysql_query($query)) {
echo "<br />The Backup created successfully!";
}
else {
echo "<br />The Backup couldn't be created!"; }

 

Any help would be appreciated.

 

Link to comment
Share on other sites

Everything seems fine, but it still won't work.  I gave this a try:

$settime = date(_mdys);
$namer = "$dbname$settime.txt";
$backupdoc = fopen("inc/backup/$namer","w");

$query = "SELECT * INTO OUTFILE '$backupdoc' FROM users";
if (mysql_query($query)) {
echo "<br />The Backup created successfully!";
}
else {
echo "<br />The Backup couldn't be created!"; }

 

But it just creates a blank file as I expected. Any Ideas??

Regards.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.