Re: MySQL Database Backup
first, you're using the shorthand option p and aren't following its rules; -p must be followed by the password (no spaces!), otherwise the console will ask you for a password as if you haven't entered it. I would suggest using --host=, --user=, and --password= instead.
also, --opt is on by default (so you don't need to enable it) and --host defaults to localhost (assuming you're never changing the host name), just so you know. feel free to look at the documentation if you need more help using mysqldump.
then, make sure the value of $command is correct and will be able to run (echo out $command and run it in the command prompt).
Re: MySQL Database Backup
Try using passthru instead of system to see the output.