ICAO and IATA code lookup
This commit is contained in:
@@ -188,4 +188,24 @@ function generatePprEmail($entryId, $email, $ac_reg) {
|
||||
logJournal($conn, $entryId, "Confirm email FAILED");
|
||||
}
|
||||
}
|
||||
|
||||
function getAirport($conn, $code) {
|
||||
$query = "";
|
||||
if (strlen($code) === 4) {
|
||||
$query = "SELECT name FROM airports WHERE icao = ?";
|
||||
} elseif (strlen($code) === 3) {
|
||||
$query = "SELECT name FROM airports WHERE iata = ?";
|
||||
} else {
|
||||
return null; // Invalid code length
|
||||
}
|
||||
|
||||
$stmt = $conn->prepare($query);
|
||||
$stmt->bind_param("s", $code);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($name);
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
return $name;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user