Jump to content

Again, search for help Flights this month per pilot


chilemugriento

Recommended Posts

Wrote a script to get VA total flights current month

This for StatsData.class

/**

* Return the number of flights current month

*

* @return int Total number of flights

*

*/

public static function Totalflightscurrentmonth($airline_code='')

{

$key = 'total_flights_month';

if($airline_code != '')

{

$key .= '_'.$airline_code;

}

$total = CodonCache::read($key);

if($total === false)

{

$sql = 'SELECT COUNT(*) AS `total`

FROM '.TABLE_PREFIX.'pireps p

WHERE month(p.submitdate) = month(now())

AND year(p.submitdate) = year(now())';

$result = DB::get_row($sql);

if(!$result)

{

$total = 0;

}

else

{

$total = $result->total;

}

CodonCache::write($key, $total, '15minute');

}

return $total;

}

and this for Index.tpl from vStatsCenter

<?php echo StatsData::Totalflightscurrentmonth(); ?>

And working fine :) :) :)

but want to show Total Flights This Month for each pilot, in pilots_list.tpl

<?php echo StatsData::Totalflightscurrentmonth()($pilot->pilotid) ?>

but had an error

Parse error: syntax error, unexpected '(', expecting ',' or ';' in /home/surair/public_html/phpvms/core/templates/pilots_list.tpl on line 72

Any help would be appreciated

Best regards.

Link to comment
Share on other sites

  • Members

You have an excess character or you havent closed the line with ; in line 72 of your pilots_list.tpl

and also the proper way to use a function is

FunctionClass::FunctionName(any nececary info like pilot id);

in your case it should be

<?php echo StatsData::Totalflightscurrentmonth($pilot->pilotid); ?>

every line in php except some spesial cases HAVE to end with ;

Link to comment
Share on other sites

Hi Vangelis, Thanks for reply.

Error in line 72 gone, but still not working, because displays VA Total Flights this month, not per pilot.

Take a look from General Statistics and Pilot´s Stats :

http://www.surair.co...p/vStatsCenter/ (first table, last column)

http://www.surair.co...ndex.php/pilots (last column) (had same value as above)

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