Possible to run mysqldump with mysql_query?
Posted: Wed Jun 07, 2006 12:25 am
Hi there,
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?
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';
}
?>