public static function getAircraftInfo($reg)
{
$reg = DB::escape($reg);
return DB::get_row('SELECT * FROM '.TABLE_PREFIX.'aircraft
WHERE `registration` ='.$reg
);
}
so it will return the hours as well..
I have no idea how I am going to this so can someone please provide the code.
There is no record for total flight hours for an aircraft in the aircraft table, or anywhere else. You will need to create a sql call to the pireps table to get the total hours for an aircraft. Something like ->
public function get_AircraftHours($id) {
$query = 'SELECT SUM(flighttime) AS total FROM '.TABLE_PREFIX."pireps WHERE aircraft='$id'";
$result = DB::get_row($query);
return $result->total;
}
The “$id” variable has to be the database id of the aircraft, not the registration as it is recorded that way in the pireps table.