<?php 

/********************************************************************************************

GNU General Public License 2.0 (http://www.gnu.org/licenses/gpl.html)
Developed By: Sheikh Arfeen Arif (http://www.meripasand.com/)
Contributed By: All Members of this project (http://code.google.com/p/mysqltablemaintenance/)

Please contribute back to community as others do.

Project: mysqltablemaintenance
URL: http://code.google.com/p/mysqltablemaintenance/
Version: alpha 0.1 (May 06, 2007)

********************************************************************************************/


// varibles for database connection

// New Database Varibles
$host = "localhost"; // db server address
$db = ""; // db name
$user = ""; // db username
$password = ""; // db password

/*********************************************************************************************/
// DB Connection
$dbserver = mysql_connect($host, $user, $password) or die("Cannot connect to server ".$host);
mysql_select_db($db, $dbserver) or die("Cannot connect to database ".$db);
/*********************************************************************************************/

// Empty the table function
	function EmptyTable($tablename)
	{
		$res = mysql_query("TRUNCATE $tablename");
		print mysql_error();
	}

	
/*********************************************************************************************/

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MySQL Table Maintenance Tools</title>
</head>

<body>
<h2>MySQL Table Maintenance Tools (alpha 0.1)</h2>
<p></p>


<h4>command: empty table1, table2</h4>
<?
// empty the tables
$dotableone = EmptyTable('table1');
$dotabletwo = EmptyTable('table2');
?>
<h5>everything has been deleted in the above tables.</h5>
</body>
</html>
