0) { ?>
query("SELECT * FROM surpresseur WHERE heure='22:00:00' and date >= '" . $date1 . "' and date <= '" . $date2 . "' ORDER BY date, heure ASC"); $while_date = $date1; $s_date = ''; while (strtotime($while_date) <= strtotime($date2)) { $tab_vol_6[$while_date] = 'null'; $s_date = $s_date . '"' . date("d/m/y", strtotime($while_date)) . '",'; $while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date))); } while ($fetch = $result_vol_6->fetch()) { $tab_vol_6[$fetch['date']] = $fetch['volume']; } $s_vol_6 = ''; $volmin = 100; $volmax = 0; $voltot = 0; $while_date = $date1; for ($i = 0; $i < count($tab_vol_6); $i++) { if (isset($tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]) && $tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))] != 'null' && $tab_vol_6[$while_date] != 'null') { // recherche mini et Maxi calcul total $vol = ($tab_vol_6[$while_date] - $tab_vol_6[date("Y-m-d", strtotime("-1 day", strtotime($while_date)))]); if ($vol < $volmin) $volmin = $vol; if ($vol > $volmax) $volmax = $vol; $voltot = $voltot + $vol; $s_vol_6 = $s_vol_6 . $vol . ','; } else $s_vol_6 = $s_vol_6 . 'null,'; $while_date = date("Y-m-d", strtotime("+1 day", strtotime($while_date))); } // calcul du nombre de jours sur l'intervalle $TDfin = strtotime($date2); // conversion timestamp $TDDeb = strtotime($date1); $Nbjours = round(($TDfin - $TDDeb) / (60 * 60 * 24)); //division des secondes pour avoir les jours //$Nbjours = 31; // Affichage des données bilan sur la période; $vmoy = $voltot / ($Nbjours); // moyenne par jour ?>