Well, it's hard to say here. Firsy, it doesn;t look like you're really using sprintf. Second, it doesn't look like you tell it what database to use. Plus, I dunno if half those variables are even defined. All I can really offer you is the script that I made, and hopefully you can take what you need from that. It is used to backup all databases...
<?php
$host = "";
$user = "";
$pass = "";
$backupdir = "/home/mysql/backups";
$backup = $backupdir."/db_backup_".date("Y-m-d");
system(sprintf("/usr/local/mysql/bin/mysqldump --all-databases -h %s -u %s -p%s > %s.sql",$host,$user,$pass,$backup));
?>