Jump to content

prblem with geting back up from db


hno

Recommended Posts

HI

I have written this script to geting back up from data base and save it in a file :

 

ob_start();

$db=mysqli_connect("localhost","root","","php");

$tableName  = 'user';

$backupFile = 'b/user.sql';

$query= "SELECT * INTO OUTFILE '$backupFile' FROM $tableName";

$result = mysql_query($query);

echo mysqli_connect_error() ;

if ($result) echo "success";

 

it is not working

 

what is the problem ?

 

thanks

Link to comment
Share on other sites

Well the main problem I can see is you've not provided us with enough details to help. In what way does it not work, what appears on screen? Does it say success but the file isn't there? Is the file there but empty? Does the screen not say success but has an error message? If so what? Is the screen blank and there's no file?

 

Help us, help you.

Link to comment
Share on other sites

db backups are a lot easier from the command line ( using mysqldump )

 

mysqldump -h host -u user -p passwd db > backup.sql

 

thanks for your reply ,but it runs on command line . I want to make a script that runs by cron job every day and make a backup from database automatically

 

 

Link to comment
Share on other sites

Well the main problem I can see is you've not provided us with enough details to help. In what way does it not work, what appears on screen? Does it say success but the file isn't there? Is the file there but empty? Does the screen not say success but has an error message? If so what? Is the screen blank and there's no file?

 

Help us, help you.

 

sorry, it is not say "success" and its not make anything . there is not error message

 

thanks for your reply

Link to comment
Share on other sites

Well the main problem I can see is you've not provided us with enough details to help. In what way does it not work, what appears on screen? Does it say success but the file isn't there? Is the file there but empty? Does the screen not say success but has an error message? If so what? Is the screen blank and there's no file?

 

Help us, help you.

 

 

sorry, it is not say "success" and its not make anything . there is not error message

 

thanks for your reply

 

please help me , it's very important . have you ran a back up script ? please give me some examples

 

thanks

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.