Jump to content

Fuel Rate average per pilot

Recommended Posts


I'm trying to create a Fuel Rate indicator for my VA, but I'm not an expert on PHP, can someone help?

I already have each pirep report showing what I called the Fuel Rate (the idea is to have a value that demonstrates, for each flight, the percentage of fuel spent in relation to what was initially foreseen by the VA for that given flight).

I did it this way:


<?php $fuelrate = substr(($pirep->routefuel - $pirep->fuelused) * 100 / $pirep->routefuel, 0, 4); echo $fuelrate?> %

(routefuel is a new column I created in the 'schedules' DB).


This is running fine, showing in each pirep report.

What I want is to have the average of this Fuel Rate per each pilot, considering all his flights. 

And I'd like to show it at the pilot's public profile.


Can somebody help?



Share this post

Link to post
Share on other sites

Thanks CedGauche, but it doesn't work. I believe is because I'm not looking for an average value of a given column. I don't have a column to get the average from. 

What I have is 2 columns from different tables that I need to apply a formula ($pirep->routefuel - $pirep->fuelused) * 100 / $pirep->routefuel).  And only then calculate the average of that formula's result.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now