Jump to content

md82

Members
  • Posts

    57
  • Joined

  • Last visited

Posts posted by md82

  1. Hello, I would like to display the smoothest landing ever in a field on my stats page. Does anyone know how?
     

    This one is working to show the VAs average landing rate:

     

    <?php echo ''.round(TouchdownStatsData::airline_average('airline'), 0); ?>

     

    How can I modify it to show the best landing rate? Thanks

  2. Hi, this is working smooth on my website. Just one problem though. Once generating the brief finishes and the template loads, the navigation on my web site appears like im logged out even though I'm still logged in. The nav bar changes the links.

  3. Hey guys, I'm trying to install the average landing function, it works for pilots who have flights logged, but for pilots with no flights yet it shows this:

    Warning: Invalid argument supplied for foreach() in /home/flynryan/public_html/allegiantvirtual.com/core/common/TouchdownStatsData.class.php on line 30

    Warning: Division by zero in /home/flynryan/public_html/allegiantvirtual.com/core/common/TouchdownStatsData.class.php on line 35

    Your Average Landing Rate: 0

    my touchdown stats data class

    <?php

    //simpilotgroup addon module for phpVMS virtual airline system

    //

    //simpilotgroup addon modules are licenced under the following license:

    //Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)

    //To view full license text visit http://creativecommons.org/licenses/by-nc-sa/3.0/

    //

    //@author David Clark (simpilot)

    //@copyright Copyright © 2009-2010, David Clark

    //@license http://creativecommons.org/licenses/by-nc-sa/3.0/

    class TouchdownStatsData extends CodonData

    {

    public function pilot_stats($pilotid) {

    $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`

    WHERE landingrate < '0'

    AND pilotid = '$pilotid'

    ORDER BY landingrate DESC";

    return DB::get_results($query);

    }

    public function pilot_average($pilotid) {

    $stats = self::pilot_stats($pilotid);

    $total = 0;

    $count = 0;

    foreach ($stats as $stat)

    {

    $total = $total + $stat->landingrate;

    $count++;

    }

    $average = $total / $count;

    return $average;

    }

    public function airline_average() {

    $stats = self::get_all_stats();

    $total = 0;

    $count = 0;

    foreach ($stats as $stat)

    {

    $total = $total + $stat->landingrate;

    $count++;

    }

    $average = $total / $count;

    return $average;

    }

    public function get_all_stats() {

    $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`

    WHERE landingrate < '0'

    ORDER BY landingrate DESC";

    return DB::get_results($query);

    }

    public function get_stats($howmany) {

    $query = "SELECT pilotid, code, flightnum, depicao, arricao, aircraft, landingrate, submitdate FROM `".TABLE_PREFIX."pireps`

    WHERE landingrate < '0'

    ORDER BY landingrate DESC

    LIMIT $howmany";

    return DB::get_results($query);

    }

    }

    any help appreciated

  4. Hi guys ! hope everyone is having a nice holiday ! I know this has come up before, but I cant find what I'm looking for.

    I've got the great circle mapper installed on my front page and working, but I want to install it in the pilot profile to show an individuals recent flights on the map. Anyone have this code ?

    • Like 1
  5. Hi, how do I make it so that when a pilot who searches for a flight, airports with no routes don't show up ? I have pilots flying charter flights, and the airport gets added to my airports listing. I want these airports with out schedules not showing up.

    I'm new to php so I wouldn't have an idea where to start.

    thanks !

  6. I currently have just one airline running on my site. I've received a lot of requests to add a charter division. The problem is I don't want pilots going crazy and just flying charter 24/7. It would be great if someone could make an addon where it extracts pilot pay if they fly charter flights. Once their balance is gone they have to fly scheduled flights again.

    thanks !

    • Like 1
  7. Thats a lot better- No errors when I go to that page- but the numbers aren't showing up..

    Total Aircraft: 52

    Total Flights Flown: 2

    Total Flights Flown On Vatsim:

    Total Hours Flown: 9.10

    Passengers Carried: 235

    Fuel Burned (lbs.): 24777

    I really appreciate the help

  8. Where should I put this code:

    <?php

    function get_onlineflights() {

    $query = "SELECT COUNT(*)AS total FROM '.TABLE_PREFIX.'pirepvalues WHERE value = 'Yes'";

    return DB::get_row($query);

    }

    ?>

    I've tried a few different places but cant figure it out..

    thanks as always !

  9. awesome ! except didnt quite get it working.

    what do I put this code inside of ?

    $total = mynewdata.class::get_onlineflights();

    echo $total->total;

    the existing codes look like

    <strong>Total Flights Today: </strong><?php echo StatsData::totalflightstoday(); ?><br>

    thanks !!

  10. hi ! I wanna add a "online flights" stat to my airline stats section. I made a custom pirep field dropdown "flew online" with the option "yes or no".. Is it possible to have a code that if "yes" was selected

    it would add to a online flight total displayed on the front of my page ?

    thanks !

    post-643-025915700 1280051661_thumb.jpg

×
×
  • Create New...