Here is the PHP script for getting the backup of Test Link database:-

################################################# 

<?php
$host = "localhost";
$database = "<DBName>";
$user = "<User Name>";
$pass = "<Password>";

$dbh = mysql_connect($host, $user, $pass) or die ("Can't connect to MySQL");
mysql_select_db($database) or die ("Can't connect to db");

$bckp_file = $database.date("Y-m-d-H-i-s").".sql";
$command = "mysqldump -h$host -u$user -p$pass $database > $bckp_file";
$database > $bckp_file;

system ($command);

?>

##########################################################

You need to only change the Database name, User Name and Password in this script.

Command for running this script:-

For Windows:-

C:\path\to\php.exe -f c:\path\to\script

For Linux:-

/path/to/php -f /path/to/script 

For automatic execution of this script, use the "at" command from command line.