mattsmith Posted March 17, 2017 Report Posted March 17, 2017 Can someone tell me the code to show a pilots last 5 flights. Quote
web541 Posted March 17, 2017 Report 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
web541 Posted March 19, 2017 Report 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
mattsmith Posted March 19, 2017 Author Report 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
web541 Posted March 20, 2017 Report 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
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.