Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Daniele  >  MySQL Dump - database backup  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: How to use the class
Class: MySQL Dump - database backup
Dump a MySQL database in a backup file
Author: By
Last change: A new example for new class version.
Date: 7 years ago
Size: 932 bytes
 

Contents

Class file image Download
<?php
    
//MySQL connection parameters
    
$dbhost '127.0.0.1';
    
$dbuser 'root';
    
$dbpsw 'root';
    
$dbname 'database_1';
    
    
//Connects to mysql server
    
$connessione = @mysql_connect($dbhost,$dbuser,$dbpsw);

    
//Includes class
    
require_once('mysqldump.php');

//Creates a new instance of MySQLDump: it exports a compressed and base-16 file
$dumper = new MySQLDump($dbname,'filename.sql',true,true);

//Use this for plain text and not compressed file
//$dumper = new MySQLDump($dbname,'filename.sql',false,false);

//Dumps all the database
$dumper->doDump();
  
//Dumps all the database structure only (no data)
$dumper->getDatabaseStructure();

//Dumps all the database data only (no structure)
$dumper->getDatabaseData();

//Dumps "mytable" table structure only (no data)
$dumper->getTableStructure('mytable');

//Dumps "mytable" table data only (no structure)
$dumper->getTableData('mytable');
?>