[FAQ] Why is there an error when updating statistics?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [FAQ] Why is there an error when updating statistics?

    USER ERROR
    Message: SQLSTATE[42000]: Syntax error or access violation: 1064 Routing query to backend failed. See the error log for further details.
    File: /includes/classes/Database.class.php
    Line: 259
    URL: xnova.nat.cu/admin.php?page=statsupdate
    PHP-Version: 7.3.29
    PHP-API: fpm-fcgi
    2Moons Version: 2.2.git
    Debug Backtrace:
    #0 /includes/classes/Database.class.php(259): PDO->query('SELECT @i := 0;')
    #1 /includes/classes/class.statbuilder.php(263): Database->nativeQuery('SELECT @i := 0;')
    #2 /includes/classes/class.statbuilder.php(443): statbuilder->SetNewRanks()
    #3 /includes/pages/adm/ShowStatUpdatePage.php(24): statbuilder->MakeStats()
    #4 /admin.php(147): ShowStatUpdatePage()
    #5 {main}
  • Cambia esa función a ver si resuelves

    Source Code: clas.statbuilder.php

    1. private function SetNewRanks()
    2. {
    3. foreach($this->Unis as $uni)
    4. {
    5. foreach(array('tech', 'build', 'defs', 'fleet', 'total') as $type)
    6. {
    7. Database::get()->nativeQuery('SET @i := 0;');
    8. $sql = 'UPDATE %%STATPOINTS%% SET '.$type.'_rank = (SELECT @i := @i + 1)
    9. WHERE universe = :uni AND stat_type = :type
    10. ORDER BY '.$type.'_points DESC, id_owner ASC;';
    11. Database::get()->update($sql, array(
    12. ':uni' => $uni,
    13. ':type' => 1,
    14. ));
    15. Database::get()->nativeQuery('SET @i := 0;');
    16. Database::get()->update($sql, array(
    17. ':uni' => $uni,
    18. ':type' => 2,
    19. ));
    20. }
    21. }
    22. }
    Display All
    VERY SAD :/ :/ :/ :/