I'm trying to backup database with mysql dump.
But thats is only can be done thru the browser because of some restriction problem.
So what i did was trying to run the mysqldump with normal mysql_query, but seem like it doesn't work.
Is there any way to make it work?
Code: Select all
<?php
@ $db = mysql_connect('localhost', 'db', 'db');
if (!$db)
{
print 'Error: Could not connect to database. Please try again later.';
exit;
}
$result = mysql_query("mysqldump --opt isas > c:/backup-file.sql") or die (mysql_error());
if($result) {
echo 'dump successful';
} else {
echo 'failed';
}
?>