Location: PHPKode > scripts > SQL Export > sql-export/example.php
<?php

	//Test code for the SQL_Export class. Replace the values below with
	//the values for your database (password must be plain text)

	$server = "localhost:3306";	//Port is not really necessary
	$username = "root";		//Username for MySQL server
	$password = "";			//Password for MySQL server
	$db = "myDB";			//Name of database

	//Connect to DB the old fashioned way and get the names of the tables on the server
	$cnx = mysql_connect($server, $username, $password) or die(mysql_error());
	mysql_select_db($db, $cnx) or die(mysql_error());
	$tables = mysql_list_tables($db) or die(mysql_error());

	//Create a list of tables to be exported
	$table_list = array();
	while($t = mysql_fetch_array($tables))
	{
		array_push($table_list, $t[0]);
	}

	//Instantiate the SQL_Export class
	require("SQL_Export.php");
	$e = new SQL_Export($server, $username, $password, $db, $table_list);
	//Run the export
	echo $e->export();

	//Clean up the joint
	mysql_close($e->cnx);
	mysql_close($cnx);

?>
Return current item: SQL Export