Jump to content

Flight this month


lorlandi

Recommended Posts

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

Link to comment
Share on other sites

  • 9 months later...

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

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