From 3664bcf3f65955fef9c8c80b13c50ac9bb124be2 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Thu, 1 Oct 2020 12:53:27 +0200 Subject: [PATCH] Add getting places by noda links to NodaIDGetter --- src/NodaIDGetter.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/NodaIDGetter.php b/src/NodaIDGetter.php index 0e92b2e..6101702 100644 --- a/src/NodaIDGetter.php +++ b/src/NodaIDGetter.php @@ -139,6 +139,38 @@ final class NodaIDGetter { } + /** + * Returns place ID by entry in place noda table. + * + * @param MDMysqli $mysqli_noda Database connection. + * @param string $noda_source Language to check in. + * @param string $noda_nrinsource Name of the place to search for. + * + * @return integer + */ + public static function getPlaceIDByNodaLink(MDMysqli $mysqli_noda, string $noda_source, string $noda_nrinsource):int { + + if (empty($name)) return 0; + + $placeByNodaResult = $mysqli_noda->query_by_stmt(" + SELECT `ort_id` + FROM `noda_orte` + WHERE `noda_source` = ? + AND `noda_nrinsource` = ? + LIMIT 2", "ss", $noda_source, $noda_nrinsource); + + if ($placeByNodaData = $placeByNodaResult->fetch_row()) { + $output = $placeByNodaData[0]; + } + else $output = 0; + + $placeByNodaResult->close(); + $placeByNodaResult = null; + + return $output; + + } + /** * Returns tag ID by entry in tag name rewriting table. *