$clan->deleteClan(); } //echo "-- clandelete --<br />"; header("Location: clans.php"); exit; } if (isset($_POST['clandeletediv'])) { $div_id = $_POST['clandiv']; $division = new Division($div_id); $q_DivScores = "SELECT " . TBL_DIVISIONS . ".*, " . TBL_TEAMS . ".*, " . TBL_PLAYERS . ".*, " . TBL_SCORES . ".*" . " FROM " . TBL_DIVISIONS . ", " . TBL_TEAMS . ", " . TBL_PLAYERS . ", " . TBL_SCORES . " WHERE (" . TBL_DIVISIONS . ".DivisionID = '{$div_id}')" . " AND (" . TBL_TEAMS . ".Division = " . TBL_DIVISIONS . ".DivisionID)" . " AND (" . TBL_PLAYERS . ".Team = " . TBL_TEAMS . ".TeamID)" . " AND (" . TBL_SCORES . ".Player = " . TBL_PLAYERS . ".PlayerID)"; $result_DivScores = $sql->db_Query($q_DivScores); $numDivScores = mysql_numrows($result_DivScores); if ($numDivScores == 0) { // Delete players, teams, members and divison $division->deleteDivPlayers(); $division->deleteDivTeams(); $division->deleteDivMembers(); $division->deleteDiv(); } //echo "-- clandeletediv --<br />"; header("Location: clanmanage.php?clanid={$clan_id}"); exit; } if (isset($_POST['clanadddiv'])) { $clan_owner = $tp->toDB($_POST['clanowner']); $div_game = $_POST['divgame']; $q = "SELECT " . TBL_DIVISIONS . ".*" . " FROM " . TBL_DIVISIONS . " WHERE (" . TBL_DIVISIONS . ".Clan = '{$clan_id}')" . " AND (" . TBL_DIVISIONS . ".Game = '{$div_game}')"; $result = $sql->db_Query($q); $num_rows = mysql_numrows($result); if ($num_rows == 0) { $q = "INSERT INTO " . TBL_DIVISIONS . "(Clan,Game,Captain)" . " VALUES ('{$clan_id}','{$div_game}','{$clan_owner}')";