Jump to content

Greased Landings Box with V2


gosox116

Recommended Posts

Guest lorathon

Lloyd,

Use this. This will limit the return to 10 for the $month & $year inserted. It will also only return accepted pireps.

I havent tried out simpilots module but you should be able to add this to his class. You may need to change the function name to something link get_monthly_stats

public function get_stats($month, $year)
{

$params = array(			
		'MONTH(submitdate)'		=> $month,
		'YEAR(submitdate)'		=> $year,
		'landingrate'			=> '< 0',
		'accepted' 			=> PIREP_ACCEPTED
		);

	$sql = 'SELECT 
			a.name as aircraft, u.firstname as firstname,
			u.lastname as lastname, u.code as pilotcode,
			u.pilotid as pilotid,
			p.code as flightcode, p.flightnum as flightnum,
			p.arricao as arricao, p.depicao as depicao,
			p.landingrate as landingrate
			FROM '.TABLE_PREFIX.'pireps as p
			LEFT JOIN '.TABLE_PREFIX.'aircraft a ON a.id = p.aircraft
			LEFT JOIN '.TABLE_PREFIX.'pilots u ON u.pilotid = p.pilotid
			';	

	$sql .= DB::build_where($params);

	$sql .= 'ORDER BY landingrate DESC LIMIT 10';

	$results = DB::get_results($sql);

	return $results;
}	

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