$count++; if ($count % 4 == 0) { echo "</tr>"; $count++; } } /*----------------------------------------------------------------------------------------------------------------*/ $week = $currentWeek; $badge40 = 0; $badge50 = 0; $badge60 = 0; $badge70 = 0; $badge80 = 0; $badge90 = 0; while ($week >= 0) { $sum_hours_week_user = calcHours($week, $currentYear, $user_display_id, $conn); if ($sum_hours_week_user >= 90) { $badge90++; } if ($sum_hours_week_user >= 80) { $badge80++; } if ($sum_hours_week_user >= 70) { $badge70++; } if ($sum_hours_week_user >= 60) { $badge60++; } if ($sum_hours_week_user >= 50) { $badge50++; }
$number_tasks += 1; } } function calcHours($week, $year, $user_id, $conn) { $sqlCalc = "SELECT SUM(sub_task_time) AS total_horas\n\t\t\tFROM sub_task LEFT JOIN task ON sub_task.task_id = task.task_id\n\t\t\tWHERE week(sub_task_date) = '{$week}' AND user_id = '{$user_id}' AND year(sub_task_date) = '{$year}'"; $resultCalc = mysqli_query($conn, $sqlCalc); if (mysqli_num_rows($resultCalc) > 0) { $row = mysqli_fetch_assoc($resultCalc); if ($row["total_horas"] == NULL) { return 0; } return $row["total_horas"]; } } $sum_hours_week_user = calcHours($currentWeek, $currentYear, $_SESSION['user_id'], $conn); ?> <html> <head> <title> Highest Good Network </title> <link href="styles/profile.css" rel="stylesheet"> <link href="styles/basicStyle.css" rel="stylesheet"> <link href='http://fonts.googleapis.com/css?family=Roboto:400,700,300,100' rel='stylesheet' type='text/css'> </head> <body> <nav> <ul> <li> <a href="profile.php" class="active"> PROFILE </a> </li>