PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Sergey Shilko   Easy MySQL Dump   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file
Class: Easy MySQL Dump
Dump the structure and data of a MySQL database
Author: By
Last change: Fixes
Date: 16 years ago
Size: 640 bytes
 

Contents

Class file image Download
<?php

$hostspec
= 'localhost';
$username = 'root';
$password = '';
$database = 'mydb';

$nodata = false; #!DO NOT DUMP TABLES DATA
$nostruct = false; #!DO NOT DUMP TABLES STRUCTURE
$gzip = false; #!DO GZIP OUTPUT

$link = mysql_connect("$hostspec", "$username", "$password",false,MYSQL_CLIENT_COMPRESS);
require_once(
getcwd()."/class_mysqldump.php");
$dump = new MySQLDump();
$dbdata = $dump->dumpDatabase($database,$nodata,$nostruct);
mysql_close($link);
if(
$gzip == false){
$dump->sendAttachFile($dbdata,'text/html','sql_dump.sql');}else{
$dump->sendAttachFileGzip($dbdata,'sql_dump.sql.gz');}
?>