mattsmith Posted March 17, 2017 Report Share Posted March 17, 2017 Can someone tell me the code to show a pilots last 5 flights. Quote Link to comment Share on other sites More sharing options...
web541 Posted March 17, 2017 Report Share Posted March 17, 2017 (edited) <?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. Edited March 19, 2017 by web541 added extra code Quote Link to comment Share on other sites More sharing options...
mattsmith Posted March 19, 2017 Author Report Share Posted March 19, 2017 No that doesn't work. Quote Link to comment Share on other sites More sharing options...
web541 Posted March 19, 2017 Report Share Posted March 19, 2017 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. Quote Link to comment Share on other sites More sharing options...
mattsmith Posted March 19, 2017 Author Report Share Posted March 19, 2017 (edited) 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 Edited March 19, 2017 by mattsmith Quote Link to comment Share on other sites More sharing options...
web541 Posted March 20, 2017 Report Share Posted March 20, 2017 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>'; ?> 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.