In you "ACARSData.class.php" file add the following function:
public static function GetFlightData($flightnum)
{
$sql = "SELECT * FROM phpvms_acarsdata WHERE flightnum = "$flightnum";
return DB::get_row($sql);
}
Now in ACARS table the flight number is not separated meaning there is only one column for flight number containing flight code and flight number combined together. In order for the function above to work, the flight code and flight nuber must be combined into one variable then passed to the function. Try the following inside your while-loop:
$flightnum = {$code.$flight_num};
$flight = ACARSData::GetFlightData($flightnum);
$aircraft = $flight->aircraft;
echo $aircraft;
This is not tested, so give it a shot I'm pretty sure it'll work.