$deep = 0; $shallow = 0; $clear = 0; $rate = 0; require '../model/healthService.class.php'; $res = HealthService::findSleep($username); if ($item = $res->fetchArray(SQLITE3_ASSOC)) { $total = $item['TOTAL']; $deep = $item['DEEP']; $shallow = $item['SHALLOW']; $clear = $item['CLEAR']; } if (is_array($_GET) && count($_GET) > 0) { if (isset($_GET["date"])) { if ($_GET['date'] != "") { $res = HealthService::findSleepByDate($username, $_GET['date']); if ($item = $res->fetchArray(SQLITE3_ASSOC)) { $total = $item['TOTAL']; $deep = $item['DEEP']; $shallow = $item['SHALLOW']; $clear = $item['CLEAR']; } } } } if ($total > 0) { $rate = round(($deep + $shallow) * 1.0 / $total, 2) * 100; } ?> <div class="wraper"> <div class="nav">