PHP Classes

Sadat PHP Database Dumper: Dump a DB using mysqldump or output SQL statements

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 73 All time: 10,228 This week: 455Up
Version License PHP version Categories
sadatdbdumper 1.0.0The PHP License5PHP 5, Databases, Systems administration
Description 

Author

This class can be used to dump a MySQL database using mysqldump or output SQL statements.

It can take the name of a database and other MySQL server connection values as parameter and creates SQL file that works as dump of a MySQL database.

The class can use either the mysqldump command or just output the SQL statements by performing database queries to discover the database tables, table fields, table properties and table records.

Picture of Hillary Kollan
  Performance   Level  
Name: Hillary Kollan <contact>
Classes: 10 packages by
Country: Ghana Ghana
Age: ???
All time rank: 32063 in Ghana Ghana
Week rank: 41 Up1 in Ghana Ghana Up
Innovation award
Innovation award
Nominee: 5x

Example

<?php

include('dump.class.php');

//set host
$sql->setDBHost('127.0.0.1');

//set host
$sql->setDBPort('3306');

//set username
$sql->setDBUsername('root');

//set password
$sql->setDBPassword('');

//set DB name
$sql->setDBName('trello');

//set sql file name
$sql->setSQLFileName('peregrin');

//set sql dump path, make sure the path has read and write privileges
$sql->setDumpPath('C:\Users/Name/Desktop/DB');

//Incase there is no mysqldump in your path or its not installed
$sql->setMySQLDump(false);

//set download, if you wanna run it through a browser and download the sql file
$sql->setDownloadSQLFile(true);

// dump
$sql->dumpDB(true);



Details

Usage

include class

    include('dump.class.php');

set host

    $sql->setDBHost('127.0.0.1');

set port

    $sql->setDBPort('3306');

set username

    $sql->setDBUsername('root');

set password

    $sql->setDBPassword('temasek209!');

set sql file name

    $sql->setSQLFileName('peregrin');

set sql dump path, make sure the path has read and write privileges

    $sql->setDumpPath('/var/www/');

Incase there is no mysqldump in your path or its not installed

$sql->setMySQLDump(false);

set download, if you wanna run it through a browser and download the sql file

$sql->setDownloadSQLFile(true);

set download, if you wanna run it through a browser and download

    $sql->setDownloadSQLFile(true);

dump MySQL File

$sql->dumpDB(true);


  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file dbdump.php Example Example script
Plain text file dump.class.php Class Class source
Accessible without login Plain text file readme.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:73
This week:0
All time:10,228
This week:455Up