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 Paul Scott  >  All DB Backup  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Script
Class: All DB Backup
Backup a database to SQL file using PEAR::DB
Author: By
Last change:
Date: 8 years ago
Size: 916 bytes
 

Contents

Class file image Download
<?php
//include the class file
include('mysql_backup_class_inc.php');

//set up the variables we will need
//NOTE: This has only been tested on MySQL!!

//set up our site name and application name for the sql file that is generated
$appname 'MySQL Backup Class';
$myurl 'http://www.example.com';
$backupPath '/var/www/phpclasses/mysql_backup/';

//SQL server variables (MySQL)
$sql_type 'mysql';
$sql_user 'myUser';
$sql_pass 'password123';
$sql_server 'localhost';
$database 'myDB';

//Instantiate the class
$dumper = new dbdump($sql_type,$sql_user,$sql_pass,$sql_server,$database,NULL);

//Get the table structure only
$struct $dumper->structureOnly($appname$myurl,$backupPath);
echo 
$struct;

//Dump out some breaks so that it looks cool
echo "<br><br><hr>";

//Get the database structure and data
$dataandstruct $dumper->dataAndStruct($appname$myurl$backupPath);
echo 
$dataandstruct;
?>