Pilots last flights

Can someone tell me the code to show a pilots last 5 flights.

\<?php $allpireps = PIREPData::getLastReports(Auth::$userinfo-\>pilotid, 5); foreach($allpireps as $pirep) { echo $pirep-\>code.$pirep-\>flightnum.' | '.$pirep-\>depicao.' - '.$pirep-\>arricao; echo '\<br /\>'; } ?\>

Did this blind, so I could be wrong.

No that doesn’t work.

The above does work for example on the profile_main template, where abouts do you want to put this info (what page?), the pilot variable is different in some places.

I want to show it in the profile_main

Error:   Warning : Invalid argument supplied for foreach() in  /home/u230581216/public_html/lib/skins/crewcenter/profile_main.php  on line  119

Has the pilot filed any flights?

Try this

\<?php $allpireps = PIREPData::getLastReports(Auth::$userinfo-\>pilotid, 5); if(!$allpireps) { echo 'No PIREPS Found For This Pilot!'; } else { foreach($allpireps as $pirep) { echo $pirep-\>code.$pirep-\>flightnum.' | '.$pirep-\>depicao.' - '.$pirep-\>arricao; echo '\<br /\>'; } } echo '\<br /\>'; echo '\<pre\>'; print\_r($allpireps); echo '\</pre\>'; ?\>