1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Sending one query at a time for player in SQLITE3

Discussion in 'Development' started by Levi, Jul 2, 2018.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    how do i send only one query per player ? i currently update player's blocks mined every time they break a block and it lags
    PHP:
    -- #    {add_blocksMined
    -- #        :username string
    -- #        :blocksMined int
    UPDATE stats
    SET blocksMined 
    blocksMined + :blocksMined
    WHERE player 
    = :username;
    -- 
    #    }
    PHP:
    public static function addBlocksMined(Player $playerint $count 1)
    {
        
    $plugin MainClass::getInstance();
        
    $plugin->provider->executeChange("add_blocksMined", [
            
    "username" => $player->getName(), "blocksMined" => $count
        
    ]);
    }
    PHP:
    public function onBreak(BlockBreakEvent $event)
        {
      
    API::addBlocksMined($player);
    }
     
  2. Awzaw

    Awzaw Zombie Pigman Poggit Admin

    Messages:
    726
    GitHub:
    awzaw
    Before you worry about lag you should get it working; you haven't even defined $player. Do you use an IDE?
     
    Last edited: Jul 3, 2018
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.