PHP Classes
Icontem

File: example.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Daniele  >  MySQL Dump - database backup  >  example.php  
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
 

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');
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products