Menu
Hi,
[B]1)
[B]2)
The goal of this is get the data throught [url]http://www.serence.com
Thank you on advance.
_Lobo
mysqldump is pretty much the only thing that will work, if each your tables has like 1000's of rows, scripts like phpmyadmin will not be capable of exporting large amounts of data[/QUOTE]
[code=php]trigger_error ('Backup failed: '.$error);[/code]
[code=php]<?php
$dbUser = 'root'; // db User
$dbPass = 'root'; // db User Password
$dbName = 'newland_tours'; // db name
$dest = '/'; // Path to directory
class MySQLDump {
/**
* The backup command to execute
* @private
* @var string
*/
var $cmd;
/**
* MySQLDump constructor
* @param string dbUser (MySQL User Name)
* @param string dbPass (MySQL User Password)
* @param string dbName (Database to select)
* @param string dest (Full destination directory path for backup file)
* @access public
*/
function MySQLDump ($dbUser,$dbPass,$dbName,$dest) {
$fname = $dbName.'.xml';
$this->cmd='mysqldump -X -u'.$dbUser.' -p'.$dbPass.' '.$dbName.
' >'.$dest.'/'.$fname;
}
/**
* Runs the constructed command
* @access public
* @return void
*/
function backup () {
system ($this->cmd, $error);
if($error)
trigger_error ('Backup failed: '.$error);
}
}
// Instantiate MySQLDump
$mysqlDump = new MySQLDump($dbUser, $dbPass, $dbName, $dest);
// Perform the backup
$mysqlDump->backup();
?>[/code]
Have you tried any debugging?
Echo out $this->cmd before you use the system call to it. Stuff like that, make sure everything is right.[/QUOTE]
[code=php] function backup()
{
system ($this->cmd, $error);
if(!empty($error))
{
trigger_error ('Backup failed: '.$error);
}
}[/code]
[code=php]<?php
class mysql_dump
{
var $cmd = '';
function mysql_dump($user, $pass, $name, $path)
{
$this->cmd = "mysqldump -q -X -u {$user} -p{$pass} {$name} -r {$path}{$name}.xml";
}
function backup()
{
passthru($this->cmd, $retval);
if(!empty($retval))
{
print_r($retval);
}
}
}
// initilize mysqldump
$dump = new mysql_dump('root', '', 'test', './');
// backup database
$dump->backup();
?>[/code]
hmm...
i have never been able to use it through php, only via the shell[/QUOTE]
[code=php]
<?php
class mysql_dump
{
var $cmd = '';
function mysql_dump($user, $pass, $name, $path)
{
$this->cmd = "mysqldump -q -X -u {$user} -p{$pass} {$name} -r {$path}{$name}.xml";
//$this->cmd = "mysqldump -q -X -u $user -p$pass $name -r $path$name.xml";
}
function backup()
{
passthru($this->cmd, $retval);
if(!empty($retval))
{
print_r($retval);
}
}
}
// initilize mysqldump
$dump = new mysql_dump('root', 'root', 'newland_tours', './');
// backup database
$dump->backup();
?>
[/code]
wow, you server is almost the same as mine lol
win 2k, apache 1.3.33, mysql 4.1.1, php 5.1
when, i first tested this, it didn't work, i realized that the mysql tools (mainly mysql_dump) was not registered, re-run the mysql config tool and chose the option to register the mysql tools or use the full path in the command (e.g. C:mysqlbinmysql_dump.exe)[/QUOTE]
0.1.9 — BETA 5.18