I ran into a wall with the monthly hub stats. I am trying to get the hours to reset every month. Shown on the red ribbon on the picture below. It only shows total hours.
Here is my code.
public static function TotalHoursBetweenDates($icao, $startdate, $enddate) { //Count total hours $query = "SELECT SUM(flighttime) as hours FROM phpvms\_pireps WHERE depicao = '$icao' OR arricao = '$icao' AND DATE(submitdate) \>= '$startdate' AND DATE(submitdate) \<= '$enddate'"; $result = DB::get\_row($query); return $result-\>hours; }
Haven’t tried it so it might not work, but you can have a go at this.
public static function TotalHoursBetweenDates($icao, $startdate, $enddate) { //Count total hours $query = "SELECT SUM(flighttime) as hours FROM phpvms\_pireps WHERE depicao = '$icao' OR arricao = '$icao' AND (submitdate BETWEEN '$startdate' AND '$enddate')"; $result = DB::get\_row($query); return $result-\>hours; }
public static function TotalHoursBetweenDates($icao, $startdate, $enddate) { //Count total hours $query = "SELECT SUM(flighttime) as hours FROM phpvms\_pireps WHERE submitdate BETWEEN '$startdate' AND '$enddate' and (depicao='$icao' or arricao='$icao')"; $result = DB::get\_row($query); return $result-\>hours; }