Jump to content

Getting PHP Warning Error [SOLVED]


PilotJordan

Recommended Posts

Hey everyone,

I'm trying to put phpVMS into a template I like, and when I use the code from frontpage_recentpilots.tpl to show the most recent pilots on the front page, it gives me this error:

Warning: Invalid argument supplied for foreach() in /home/airtranv/public_html/lib/skins/AirTran/layout.tpl on line 223

Here is the code that I used which resulted in that error


<?php

foreach($pilots as $pilot)
{
?>
<p><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a></p>
<?php
}
?>

Link to comment
Share on other sites

  • Moderators

You just only needed to add the $pilots function.

Example...

<?php
$count = 5;
$pilots = PilotData::GetLatestPilots($count);
foreach($pilots as $pilot)
{
?>
<p><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a></p>
<?php
}
?>

  • Like 1
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...