This script has been working fine and last time it was run was 29/12/2008
I came to run it today and nothing, no errors says it ran fine but the database wasnt being updated and file wasnt being created.
I have a feeling it is something to do with the year change over but not totally sure
Any help would be great
[code=php]<?php
$server = “localhost”;
$user = “root”;
$pass = “root”;
$db = “test”;
mysql_connect($server, $user, $pass)
or die(mysql_error());
mysql_select_db($db)
or die(mysql_error());
$result = mysql_query(“SELECT * FROM backup WHERE backup_id = 1”)
or die(mysql_error());
$row = mysql_fetch_array($result);
$atoms = explode(‘-‘,$row[‘backup_last’]);
$year = $atoms[0];
$month = $atoms[1];
$atoms2 = explode(‘ ‘,$atoms[2]);
$day = $atoms2[0];
$db_amount = $row[‘times_backedup’];
$today = date(“m-d-Y”, mktime(date(“m”), date(“d”), date(“Y”)));
$date_to_compar = date(“m-d-Y”, mktime(0, 0, 0, $month, $day, $year));
if($today > $date_to_compar)
{
$day = (date(“dmY”));
$filename=”backup/data/$day.sql”;
if (file_exists($filename))
{
unlink(“$filename”);
}
system(“C:wampbinmysqlmysql5.1.30binmysqldump –opt –no-create-db –user=$user –password=$pass –host=$server $db > $filename”);
$db_amountupdated = $db_amount + 1;
mysql_query(“UPDATE backup SET times_backedup = $db_amountupdated WHERE backup_id = 1”)
or die(mysql_error());
echo $filename;
}
?>