-> so if you are using Linux you'll be using cron to run a script at a certain time each day. you are unlikley to call a PHP script. you are likely to run a script which logs into the MySQL database and then runs a few queries.
re "If a backup copy already exists the script shud check to see if it exists , delete it and then load a fresh copy of the data again."
-> For example, use:
DROP TABLE IF EXISTS `database_name`.`backup_table_name` ;
CREATE TABLE `database_name`.`backup_table_name` (
`received` date NOT NULL default '0000-00-00',
`replied` date NOT NULL default '0000-00-00'
) TYPE = MYISAM ;
INSERT INTO `database_name`.`backup_table_name`
SELECT *
FROM `database_name`.`live_table_name` ;
note: depending on your needs you might prefer to clear the data in the backup table using the following "truncate" statement instead of dropping and re-creating the backup table:
TRUNCATE TABLE `temp2`;