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 Raul  >  DB Backup Class  >  Example.php  >  Download  
File: Example.php
Role: Example script
Content type: text/plain
Description: Example
Class: DB Backup Class
Generate a MySQL database backup using PDO
Author: By
Last change:
Date: 2010-10-26 08:25
Size: 537 bytes
 

Contents

Class file image Download
<?php
include 'DBBackup.class.php';
$db = new DBBackup(array(
    
'driver' => 'mysql',
    
'host' => '127.0.0.1',
    
'user' => 'root',
    
'password' => '',
    
'database' => 'teste_backup'
));
$backup $db->backup();
if(!
$backup['error']){
    
// If there isn't errors, show the content
    // The backup will be at $var['msg']
    // You can do everything you want to. Like save in a file.
    // $fp = fopen('file.sql', 'a+');fwrite($fp, $backup['msg']);fclose($fp);
    
echo nl2br($backup['msg']);
} else {
    echo 
'An error has ocurred.';
}
?>