Changeset 10


Ignore:
Timestamp:
Jun 6, 2008, 9:12:32 AM (17 years ago)
Author:
george
Message:

Opraveno: Použití nulových hodnot při aktualizaci dat serverů namísto hodnoty NULL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/online.php

    r8 r10  
    4848 
    4949  // Calculate latency average
    50   $DbResult = $Database->query("SELECT AVG(`latency`) as `latency` FROM `servers_online` WHERE `server` = ".$Server['id']." AND `state` = 1 AND `latency` != 0");
     50  $DbResult = $Database->query("SELECT COALESCE(AVG(`latency`), 0) as `latency` FROM `servers_online` WHERE `server` = ".$Server['id']." AND `state` = 1 AND `latency` != 0");
    5151  $DbRow = $DbResult->fetch_array();
    5252  $Latency = $DbRow['latency'];
     
    5454
    5555  // Calculate cached percentage online state
    56   $DbResult = $Database->query("SELECT COUNT(*) as `count`, SUM(`state`) as `online` FROM `servers_online` WHERE `server` = ".$Server['id']);
     56  $DbResult = $Database->query("SELECT COALESCE(COUNT(*), 1) as `count`, COALESCE(SUM(`state`), 0) as `online` FROM `servers_online` WHERE `server` = ".$Server['id']);
    5757  $DbRow = $DbResult->fetch_array();
    5858
Note: See TracChangeset for help on using the changeset viewer.