Guest lorathon Posted June 5, 2010 Report Share Posted June 5, 2010 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; } Quote Link to comment Share on other sites More sharing options...
llju1 Posted June 6, 2010 Report Share Posted June 6, 2010 Thanks lorathon and simpilot. I have tried your code with every combination I can think of I even changed the$sql to $query. nothing works. so I will give up for a bit. 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.