Tag Archives: Database

PHP Class to Export/Import MySQL database

4 Dec

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.


– PHP 5 and DOM XML.
– Truncate all previous data.
– Do not Drop/Alter database table
– Database Schema and Data save in XML format.


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.


/* Include the lib file */

/* 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();

/* Download the file from browser */

/* Save Database file in disc */

/* Import database */