Jump to content

Recommended Posts

Posted

Well, after some test finaly the code is working good for to show the total flights on current month, for expert this is easy but for me is a great thing, i added following code on StatsData.class on line 782.

/**

* Return the total number of Flights current Month

*

*

*/

public static function Totalflightsmonth()

{

$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;

}

Best regards

  • 9 months later...
Posted

Well, after some test finaly the code is working good for to show the total flights on current month, for expert this is easy but for me is a great thing, i added following code on StatsData.class on line 782.

/**

* Return the total number of Flights current Month

*

*

*/

public static function Totalflightsmonth()

{

$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;

}

Best regards

and how, or where will the be displayed

Posted

You can add it anywhere you want to by calling it with the following:

<p><strong>Flights This Month: </strong><?php echo StatsData::Totalflightsmonth(); ?></p>

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