Exemple #1
0
    $result_ClanScores = $sql->db_Query($q_ClanScores);
    $numClanScores = mysql_numrows($result_ClanScores);
    if ($numClanScores == 0) {
        // Delete players, teams, members, divisions and clan
        $q_ClanDivs = "SELECT " . TBL_DIVISIONS . ".*" . " FROM " . TBL_DIVISIONS . " WHERE (" . TBL_DIVISIONS . ".Clan = '{$clan_id}')";
        $result_ClanDivs = $sql->db_Query($q_ClanDivs);
        $numClanDivs = mysql_numrows($result_ClanDivs);
        for ($i = 0; $i < $numClanDivs; $i++) {
            $div_id = mysql_result($result_ClanDivs, $i, TBL_DIVISIONS . ".DivisionID");
            $division = new Division($div_id);
            $division->deleteDivPlayers();
            $division->deleteDivTeams();
            $division->deleteDivMembers();
            $division->deleteDiv();
        }
        $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();