Просмотр файла phpmytourney/install-uninstall/dropdb.php

Размер файла: 2.3Kb
<?
/***********************************************************
* This file was created by Jйrфme Poulin under the phpmytourney
* project.  
* You can modify and redistribute this file as long as this
* copyright notice stays in the file.
*
* If you want to do major upgrades on my script, please contact
* me and we could work together.
* 
* Jйrфme Poulin
* Student University of Sherbrooke
* [email protected] <== dont use for support !!!
* http:/phpmytourney.sourceforge.net/ <== use sourceforce forum for support
* 
*  phpMyTourney <C> 2001-2002
************************************************************/
/***********************************************************
*	filename : dropdb.php
*	Created by : Jйrфme Poulin@09-02-2002
*	Last modified : Jйrфme Poulin@09-02-2002
************************************************************/

include('../config.inc');
include($path_common . 'mysql.inc');

$nb_tourney = get_mysql_value("SELECT max(id) from  " . $GLOBALS['dbtable_header'] . "info");

// This is a bunch of drop table to delete the tourney specific data
// note that there table are delete when deleting a tournament using the 
// admin scripts.  This means that all deleted tournaments will generate
// 3 errors when running this script...
for($i=1;$i<=$nb_tourney;$i++){
	$query[] = "DROP table  " . $GLOBALS['dbtable_header'] . "data_" . $i;
	$query[] = "DROP table  " . $GLOBALS['dbtable_header'] . "signup_" . $i;
	$query[] = "DROP table  " . $GLOBALS['dbtable_header'] . "team_members_" . $i;	
}

// The only 2 initial tables created with createdb.php
$query[] = "DROP TABLE  " . $GLOBALS['dbtable_header'] . "info";
$query[] = "DROP TABLE ALLTOURNEY_players";


if (execute_queries($query,"smooth"))
	echo("<br><b>All table were deleted with no problemo</b>");
else{
	echo("	<br><b>An Error occured...
		<br><br>NOTE :</B> It is relativly normal to have error executing this.  Because
		this script is trying to erase ALL table that he could have created.  This means
		if you have 15 singles tourney, he will still try to delete 15 team related tables...
		Also, every tourney you delete via tourneyadmin script will generate 3 error in here.");		
	echo("<br><font color=\"#ff0000\">NOTE 2 : Only the last 2 tables droped should never generate errors.</font>");
}
?>