hello Division by Zero error

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

    • hello Division by Zero error

      New

      Division by Zero error I am getting an error here How can I fix

      prntscr.com/nc6hdl

      prntscr.com/nc6hrr

      prntscr.com/nc6i0r


      how to fix this error pls

      Code:

      Source Code

      1. $totalUnits = $statisticResult['lostunits'] + $statisticResult['desunits'];
      2. $varLost = 100/$totalUnits * $statisticResult['lostunits'];
      3. $varDest = 100/$totalUnits * $statisticResult['desunits'];
      4. $this->assign(array(
      5. 'DiploInfo' => $this->getDiplomatic(),
      6. 'ally_web' => $this->allianceData['ally_web'],
      7. 'allianceLevel' => $this->allianceData['allianceLevel'],
      8. 'alliance_storage_metal' => $this->allianceData['alliance_storage_metal'],
      9. 'alliance_storage_crystal' => $this->allianceData['alliance_storage_crystal'],
      10. 'alliance_storage_deuterium'=> $this->allianceData['alliance_storage_deuterium'],
      11. 'alliance_storage_research' => $this->allianceData['alliance_storage_research'],
      12. 'alliance_storage_darkmatter'=> $this->allianceData['alliance_storage_darkmatter'],
      13. 'alliance_storage_stellar' => $this->allianceData['alliance_storage_stellar'],
      14. 'ally_tag' => $this->allianceData['ally_tag'],
      15. 'ally_members' => $this->allianceData['ally_members'],
      16. 'ally_max_members' => $this->allianceData['ally_max_members'],
      17. 'ally_name' => $this->allianceData['ally_name'],
      18. 'ally_name' => $this->allianceData['ally_name'],
      19. 'allianceDivision' => $this->allianceData['allianceDivision'],
      20. 'ally_description' => BBCode::parse($this->allianceData['ally_description']),
      21. 'ally_text' => BBCode::parse($this->allianceData['ally_text']),
      22. 'rankName' => $rankName,
      23. 'requests' => sprintf($LNG['al_new_requests'], $ApplyCount),
      24. 'applyCount' => $ApplyCount,
      25. 'totalfight' => $statisticResult['wons'] + $statisticResult['loos'] + $statisticResult['draws'],
      26. 'fightwon' => $statisticResult['wons'],
      27. 'fightlose' => $statisticResult['loos'],
      28. 'fightdraw' => $statisticResult['draws'],
      29. 'nextStorage' => $USETT['nextStorage'] > TIMESTAMP ? 1 : 0,
      30. 'nextAllowed' => $USETT['nextStorage'] - TIMESTAMP,
      31. 'unitsshot' => pretty_number($statisticResult['desunits']),
      32. 'unitslose' => pretty_number($statisticResult['lostunits']),
      33. 'dermetal' => pretty_number($statisticResult['kbmetal']),
      34. 'dercrystal' => pretty_number($statisticResult['kbcrystal']),
      35. 'isOwner' => $this->allianceData['ally_owner'] == $USER['id'],
      36. 'ally_events' => $ally_events,
      37. 'varLost' => min(100,$varLost),
      38. 'varDest' => min(100,$varDest),
      39. 'lostunits1' => max(1,$statisticResult['lostunits']),
      40. 'desunits1' => max(1,$statisticResult['desunits']),
      41. ));
      Display All
    • New

      1. $varLost = 100/$totalUnits * $statisticResult['lostunits'];
      2. $varDest = 100/$totalUnits * $statisticResult['desunits'];
      Change to

      1. $varLost = $totalUnits == 0 ? 0 : 100/$totalUnits * $statisticResult['lostunits'];
      2. $varDest = $totalUnits == 0 ? 0 : 100/$totalUnits * $statisticResult['desunits'];
      - Xterium Template
      - War of Alliance Template
      - Antaris-Legacy Template
      - Ogame Template

      I can and will only help with instalation with hostings including cpanel or plesk and an teamviewer access