Jump to content

Recommended Posts

Posted

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.

Posted

The fact is that $pirep->aicraft contains the ICAO not the ID in the table so the end query looks smth like ".... WHERE `id`='B738'" which returns an empty object/array.

You need to pass the aircraft ID, not the ICAO. :)

  • Moderators
Posted

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

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