Hi at all,
I read this contribute on
www.php.net about backup of mysql databases and/or
tables using PHP system function
with this script I tryed to write a custom script to save only one table or
more tables excluding others but my script not work.
my script is:
<?php
// Enter your MySQL access data $host= '00.000.000.'''; $user=
'Sqlmyuserid'; $pass= 'mypassword';
$db= 'Sql00000_nn';
//Tables to save added by me
$table1="rows";
$table2="headers";
$backupdir = 'backups';
// Compute day, month, year, hour and min.
$today = getdate();
$day = $today[mday];
if ($day < 10) {
$day = "0$day";
}
$month = $today[mon];
if ($month < 10) {
$month = "0$month";
}
$year = $today[year];
$hour = $today[hours];
$min = $today[minutes];
$sec = "00";
// Execute mysqldump command.
// It will produce a file named $db-$year$month$day-$hour$min.gz
// under $DOCUMENT_ROOT/$backupdir
system(sprintf(
'mysqldump --opt -h %s -u %s -p%s %s | gzip %s/%s/%s-%s%s%s-%s%s.gz',
$host,
$user,
$pass,
$db $table1 $table2,
getenv('DOCUMENT_ROOT'),
$backupdir,
$db,
$year,
$month,
$day,
$hour,
$min
)); echo '+DONE'; ?>
Please can you tell me how can I do correctly to add the name of tables to
backup?
Best regards and thank you very much