Jump to content

Monthly Hub Stats(Solved)


flyalaska

Recommended Posts

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.

hubs_.jpg

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!

Edited by flyalaska
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...