Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Modifying Old Code

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #37503
    PokerAcesKid
    Member

    I’m trying to figure out how I can reduce as much functionality as possible and still keep it doing what it needs to do. What I mean by functionality is the number of queries being performed or any of the other code for that matter. I do show at the bottom of my post what I have so far, however that doesn’t cover all the queries.


    if ($access_level_id == 2 || $access_level_id == 3) {
    $query = "SELECT
    characters.id
    FROM
    characters";
    $result = mysqli_query ($dbc,$query);
    $total_num_characters = mysqli_num_rows($result);

    $query = "SELECT
    user_characters.id
    FROM
    user_characters
    INNER JOIN user_accounts
    ON user_accounts.id = user_characters.user_id";
    } else {
    $query = "SELECT
    user_characters.id
    FROM
    user_characters
    INNER JOIN user_accounts
    ON user_accounts.id = user_characters.user_id
    WHERE
    user_accounts.id = '".$user_id."'";
    }
    $result = mysqli_query($dbc,$query);
    echo

    $num_available_characters = mysqli_num_rows($result);
    if (($num_available_characters > "1") || (($access_level_id == 2 || $access_level_id == 3) && (isset($total_num_characters)) && ($total_num_characters > "0"))) {
    ?>



    } else {
    print "

    ".$default_character_name."

    n";
    }
    ?>

Viewing 1 post (of 1 total)
  • The forum ‘Back End’ is closed to new topics and replies.