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

Join the conversation

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

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.


  • Create New...