Last night I was getting fed up on updating my remote database from my local. It’s a pain to login hosting control panel each time then import data.
Then I thought, why not I develop a small script for that. Finally I came up with a PHP class to import/export MYSQL Database. Let me share with you.
FEATURES
- PHP 5 and DOM XML.
- Truncate all previous data.
- Do not Drop/Alter database table
- Database Schema and Data save in XML format.
DOWNLOAD
Version 0.1.1 (New):
Download Link
svn checkout http://backupdatabase.googlecode.com/svn/trunk/Version 0.1.0:
Download the script from box.net.
Example:
/* Include the lib file */
include('dbimexport.php');
/* Dabase configuration */
$db_config = Array
(
'dbtype' => "MYSQL",
'host' => "DB_HOST_NAME",
'database' => "DB_NAME",
'user' => "DB_USER",
'password' => "DB_PASSWORD",
);
// Initiate main class
$dbimexport = new dbimexport();
$dbimexport->addValue("db_config",$db_config);
/* Download the file from browser */
$dbimexport->addValue("download_path","")
->addValue("download",true)
->addValue("file_name","MyBackUp.xml")
->export();
/* Save Database file in disc */
$dbimexport->addValue("download_path","auto_save.xml")
->addValue("download",false)
->export();
/* Import database */
$dbimexport->addValue("import_path","auto_save.xml")
->import();







Mentors Award Q3 2008
Top Website Coder