PHP Classes

File: example.php

Recommend this page to a friend!
  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: 16 years ago
Size: 916 bytes


Class file image Download
//include the class file

//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 = '';
$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);

//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);

For more information send a message to info at phpclasses dot org.