Jump to content

Top Routes


freshJet

Recommended Posts

This was originally a cry for help, but here's a nifty piece of code for you all to use. It shows the top five most frequent flights flown bu the airline.

public function topRoutes(){
$query = "SELECT depicao, arricao, COUNT(*) AS count FROM phpvms_pireps GROUP BY depicao, arricao ORDER BY count DESC LIMIT 5";
$results = DB::get_results($query);
return $results;
}

You can then return the depicao, arricao and count.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

You can also use the built in function

StatsData::TopRoutes($airline_code)

which also will cache the data for a couple of hours (on release versions of phpVMS) to lighten the load on the system.

I looked at the default, mine is better as the default only shows the top routes based on the timesflown in the schedules. When you overwrite your schedules, these are reset to zero. With mine, it counts the routes manually from the PIREPs.

Link to comment
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.

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...