Monthly Hub Stats(Solved)

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; }

 

\<?php echo HubStats::TotalHoursBetweenDates('PACD', date("Y-m-01"), date("Y-m-t"));?\>

Any help would be appreciated!

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; }

 

That did not work

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; }

 

That doesn’t work

I am sure that this function is working as i tested it can you attach the php files that you use ?

1 Like

Its working now, I forgot a step. Thank you so much,

Any idea on getting this to work? I have the total showing but I’d like to show only the current month’s result.

 

edit: Ah.. seems as though it is showing the current month’s only

Regards,

Pete