I am trying to create a script that would run through a cron job, so it would dump the database on a regular basis. I also tried a couple of combinations with quotations and dots, but neither worked.
<?php
$date = date('Y-m-d-H:i:s');
$host = 'localhost';
$user = 'username';
$password = 'password';
$database = 'databasename';
echo shell_exec("mysqldump -h $host -u $user -p$password $database > mysqlbackup$date.sql");
?>