<?php 
error_reporting(1);

$backup_pate 	= 'assets/database_backup/';
$date 			= date('Y-m-d');

$all_db = array(
	"1" => array('name' => 'attrans', 			'user' => 'root',	'password' => "",	'host'=>'localhost'),
);

if (!file_exists($backup_pate . $date)) {
	mkdir($backup_pate . $date, 0777, true);
}

foreach($all_db as $db){		
	$file_name = $backup_pate . $date . '/' . $db['name'] . '.sql';
	if (!file_exists($file_name)) {
		unlink($file_name);
	}

	echo exec("mysqldump --user='".$db['user']."' --password='".$db['password']."' --host='".$db['host']."' ".$db['name']." > $file_name");
}