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
So the only hy to export all is mysqldump but how I should use it ? Can you make a samll sample for me creating a XML file with php ? or can you point me to a tutorial ?
Thank you on advance.
_Lobo_
Originally Posted by ShrineDesigns
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
Notice: Backup failed: 1 in e:\wamp\www\FA06\admin4\xml\xml.php on line 38
line 38
PHP Code:
trigger_error ('Backup failed: '.$error);
all my code:
PHP Code:
<?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();
?>
MySQLDump
There are three general ways to invoke mysqldump:
shell> mysqldump [options] db_name [tables]
shell> mysqldump [options] --databases DB1 [DB2 DB3...]
shell> mysqldump [options] --all-databases
--xml, -X
Write dump output as well-formed XML.
--password[=password], -p[password]
The password to use when connecting to the server. If you use the short option form (-p), you cannot have a space between the option and the password. If you omit the password value following the --password or -p option on the command line, you are prompted for one.
--user=user_name, -u user_name
The MySQL username to use when connecting to the server.
Ok I test the file several time and don't work for me I send the file to a friend and he told me that the file was created but with nothing inside. Someone can confirm this please?
(Something that I found but dont have a clue how to use it someone can show me? http://www.adsworth.info/mysql2xml)
what is this? XMLDefinition( "localhost", "test", "root", "root", "mos_categories", "rootnodename", "rownodename","iso-8859-1")
Bookmarks