<?php
//include class
require_once('./MySQLDump.class.php');
//create new instance of MySQLDump
$backup = new MySQLDump();
//set drop table if exists
$backup->droptableifexists = true;
//connect to mysql server (host, user, pass, db)
$backup->connect('localhost','root','','mysql');
//if not connected, display error
if (!$backup->connected) { die('Error: '.$backup->mysql_error); }
//dump single table
$backup->dump_table('example_table');
echo "<pre>".htmlspecialchars($backup->output."</pre>"; //we can use htmlspecialchars in case that there are some html tags in database
//dump entire db
$backup->dump();
echo "<pre>".htmlspecialchars($backup->output."</pre>"; //we can use htmlspecialchars in case that there are some html tags in database
//dump few tables
$backup->dump_table('example_table');
$backup->dump_table('second_table', false); //set 2nd argument to false to keep previous table(s) in output stream
echo "<pre>".htmlspecialchars($backup->output."</pre>"; //we can use htmlspecialchars in case that there are some html tags in database
?>
|