Login   Register  
PHP Classes
elePHPant
Icontem

this is how I use it

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      MySQL Dump  >  All threads  >  this is how I use it  >  (Un) Subscribe thread alerts  
Subject:this is how I use it
Summary:this is how I use it
Messages:1
Author:Dino L.
Date:2005-10-26 11:36:45
 

  1. this is how I use it   Reply  
Picture of Dino L.
Dino L.
2005-10-26 11:36:45
<?php
mysql_connect("localhost", "usr", "pass");
require("class_mysqldump.php");
$dump = new MySQLDump();
$somecontent = $dump->dumpDatabase("bbm");
//timestamp file name
$filename = date("Y-m-d_H_i-").'backup.sql';
//open a new file
if (!$handle = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
}
//write it
if (fwrite($handle, $somecontent) === FALSE){
echo "Cannot write to file ($filename)";
exit;
}

fclose($handle);
//send a good header so user can choose to download file...
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=$filename");
readfile($filename);
//if u like u can delete file now :) I wont ;)
?>