Backup selected tables in mysql db to a sql file

I found this snippet on stackoverflow:

mysqldump db_name table_name > table_name.sql

How do I write it into a mysql query if I wanted to save the output to e:\sql\alpha.sql?

I made this attempt, but no go:

mysql_query("mysqldump emily alpha > e:\\sql\\alpha.sql") or die(mysql_error());

Obviously, I need to use shell_exec().

This code produces empty output (my db doesn’t have a pw).

shell_exec("mysqldump armor '' emily alpha > e:/sql/alpha2.sql");



This works from the command line:

e:\\wamp\\bin\\mysql\\mysql5.1.33\\bin\\mysqldump -h localhost -u armor -p  emily alpha> e:\\sql\\alpha4.sql

How do I run this from php without being promped for a pw? I thought I could use shell_exec(), but no joy.


shell_exec("\\wamp\\bin\\mysql\\mysql5.1.33\\bin\\mysqldump -h localhost -u armor emily alpha> e:\\sql\\alpha5.sql");

Was missing the path for mysqldump.