freshJet Posted January 1, 2014 Report Posted January 1, 2014 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. 1 Quote
Txmmy83 Posted January 3, 2014 Report Posted January 3, 2014 Thanks Iain, great I was looking for that for a longtime but where should that code but in? Quote
freshJet Posted January 4, 2014 Author Report Posted January 4, 2014 You can either place it in PilotStats.class.php or in your own class file. Call it by doing: echo PilotStats::topRoutes(); Quote
Administrators simpilot Posted January 6, 2014 Administrators Report Posted January 6, 2014 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. Quote
freshJet Posted January 6, 2014 Author Report Posted January 6, 2014 Oh, I didn't realise there was a default function Quote
freshJet Posted January 18, 2014 Author Report Posted January 18, 2014 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. Quote
Administrators simpilot Posted January 21, 2014 Administrators Report Posted January 21, 2014 Cool, you should send a pull request to the GitHub account, maybe Nabeel will update the code next time he does a merge. 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.