Jump to content

public static function PilotAircraftFlownCounts($pilotid)


Recommended Posts

Posted

How do I fix this function?  StatsData::<?php echo PilotSircraftflownCounts($pilot->pilotid); ?>     When I type this in, The output is the word "array" I am running phpvms 5.5.2 and TFDIdesign is the host. I do not know nothing about php, java script, I know basic HTML.

 

Can anyone show me the script I need to add to this function to make it work? Thanks.

  • Administrators
Posted

Need to see the entire error message.

Is this in the default phpVMS 5.5.2 files or an addon module?

If an addon module, which one?

What is the file name and line number?

 

What PHP version?

What MySql or MariaDB version?

Posted

DesposableHero I do not know anything about PHP or ARRAY's. I would need to have someone write the script  for me.

 

ProAvia no error message, just the word "Array". This a default function from the file name core/common/StatsData.class.php. Refer you to line 456, (public static function PilotAircraftFlownCounts($pilotid) )

 

PHP version is 5.3.29

Mysql version is 5.7.34-cll-lve

  • Administrators
Posted

phpVMS 5.5.2 will not work correctly with MySQL versions higher than 5.7.4

 

Do you have error reporting turned on? Anything in the error_log file?

Posted

I do not know if error reporting if turned on. And no there is nothing in the error_log file.  From what you are telling me, this function needs to be rewritten with a new script or maybe it will never work??? I will work on getting you an error message. 

  • Administrators
Posted

It could be something very simple or something very complex. Without the error log, no telling what the issue is.

 

You say you are "typing it in". Exactly what are you typing in? What is the expected output?

 

The line you reference is actually line 453 (not 456) in the default StatsData.class.php file. Check to see if it works with the default file.

 

And the pie chart that is supposed to display may no longer work because Flash Chart (or whatever it was called) is no longer supposed/available in most browsers. Search the forums for Morris Chart or Google Chart to see if there is a possible alternate to use.

 

Posted

I understand. I add this statement to a column in a table-> StatsData::<?php echo PilotSircraftflownCounts($pilot->pilotid); ?>

 

The output that I am hoping for is a table with two columns. The Name of the aircraft flown and the hours flown in each aircraft by each pilot. I am adding this to the profile_main.php.

 

I have also tried -> StatsData::<?php echo PilotSircraftflownCounts($userinfo->pilotid); ?>  and either of them work. The output is the same. The word "array".

 

I done the default StatsData.class.php file. Same output.

 

I do have a pie chart working. There is one I found with Google chart and it shows the aircraft flown, but no hours.

 

I wish I could find a script that I could add to the profile_main.php that would give me the aircraft flown and hours for each pilot in my VA. No luck and would most likely have to pay someone, Paying someone is not a option, I will do without. I do think the script would go viral with all the VA's that use phpvms. IMO.

 

 

  • Administrators
Posted

There are possibly some payware alternatives - or you could try to write your own.

 

One issue I see is you say:

"... PilotSircraftflownCounts ...."

when it should be

... PilotAircraftflownCounts ...

The 'S' should be an 'A'

Posted

Sorry, typing error. Payware is an option. Writing my own is not. 

 

ProAvia, your the man! Thank-you for help.

 

I see your near KPHX, I am just north of you, near KBVU.

 

Again Thank-you, Thank-you. Thread closed.

Posted (edited)

NO, When I posted this, I made a typing error. 

 

This is the script I am refering to:

 

 /**
     * StatsData::PilotAircraftFlownCounts()
     *
     * @param mixed $pilotid
     * @return
     */
    public static function PilotAircraftFlownCounts($pilotid) {

        $key = 'ac_flown_counts_' . $pilotid;
        
        
        $counts = CodonCache::read($key);
        if ($counts === false) {
            //Select aircraft types
            $sql = 'SELECT a.name AS aircraft, COUNT(p.aircraft) AS count, SUM(p.flighttime) AS hours
                    FROM ' . TABLE_PREFIX . 'pireps p, ' . TABLE_PREFIX . 'aircraft a
                    WHERE p.aircraft = a.id AND p.pilotid=' . intval($pilotid) . '
                    GROUP BY a.name';

            $counts = DB::get_results($sql);
            CodonCache::write($key, $counts, 'medium');
        }

        return $counts;
    }

Edited by Ricky310
  • 3 weeks later...
Posted

After further investigation , I suspect there is a error in the CodonCache.php file. That will not allow this function to work properly. It is these lines of script that I am refering to:  $counts = CodonCache::read($key);   and    CodonCache::write($key, $counts,  'medium'); . This is way above my skill level to fix and way too expensive to hire someone. I got a quote from a web designer, $500 to $700 USD. This is highway robbery.

 

I will do without this function and keep my aircraft hours on a spread sheet. 

 

I have yet to find a Virtual Airline that uses Pilots Aircraft Hours stat, or this function.

 

Cheers!

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