Ricky310 Posted June 1, 2021 Report Share Posted June 1, 2021 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. Quote Link to comment Share on other sites More sharing options...
DisposableHero Posted June 2, 2021 Report Share Posted June 2, 2021 Looks like you are trying to echo an array, you may need to do a loop in that array to get the results or implode it ... Solution depends on the array structure and contents, also your expected result. https://www.php.net/manual/en/language.types.array.php https://www.php.net/manual/en/function.implode.php https://www.php.net/manual/en/control-structures.foreach.php Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted June 2, 2021 Administrators Report Share Posted June 2, 2021 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? Quote Link to comment Share on other sites More sharing options...
Ricky310 Posted June 2, 2021 Author Report Share Posted June 2, 2021 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 Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted June 3, 2021 Administrators Report Share Posted June 3, 2021 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? Quote Link to comment Share on other sites More sharing options...
Ricky310 Posted June 3, 2021 Author Report Share Posted June 3, 2021 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. Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted June 3, 2021 Administrators Report Share Posted June 3, 2021 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. Quote Link to comment Share on other sites More sharing options...
Ricky310 Posted June 3, 2021 Author Report Share Posted June 3, 2021 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. Quote Link to comment Share on other sites More sharing options...
Ricky310 Posted June 3, 2021 Author Report Share Posted June 3, 2021 I am unable to get an error message. Thank-you for your help. Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted June 3, 2021 Administrators Report Share Posted June 3, 2021 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' Quote Link to comment Share on other sites More sharing options...
Ricky310 Posted June 4, 2021 Author Report Share Posted June 4, 2021 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. Quote Link to comment Share on other sites More sharing options...
Administrators ProAvia Posted June 4, 2021 Administrators Report Share Posted June 4, 2021 So changing the 'S' to an 'A' solved the issue? Quote Link to comment Share on other sites More sharing options...
Ricky310 Posted June 4, 2021 Author Report Share Posted June 4, 2021 (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 June 4, 2021 by Ricky310 Quote Link to comment Share on other sites More sharing options...
Ricky310 Posted June 20, 2021 Author Report Share Posted June 20, 2021 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! Quote Link to comment Share on other sites More sharing options...
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.