Jump to content

Null array


HighFlyerPL185

Recommended Posts

Hi there, I'm trying to print the aircraft's full name, but the array comes out as NULL. Any ideas?

$aircraft = OperationsData::getAircraftInfo($pirep->aircraft);
<?php echo $aircraft->fullname; ?>

If I do var_dump($aircraft); it comes out as NULL. $pirep is taken from a foreach($pireps as $pirep).

I'm trying to parse it in frontpage_main.tpl.

Link to comment
Share on other sites

  • Moderators

PIREPS report aircraft ID in the table, so add the following to your "OperationsData.class.php":

public function GetAircraftById($id)
{
$sql="SELECT * FROM phpvms_aircraft WHERE id='$id' ";
return DB::get_row($sql);
}

And:

$aircraft = OperationsData::GetAircraftById($pirep->aircraft);
<?php echo $aircraft->fullname; ?>

This will give you aircraft full name. :D

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