public static function GetByName($name) { global $MySQL; $query = "SELECT * FROM " . System::GetConfigurationValue("Database.TablePrefix") . "Languages WHERE language_Name = '" . $MySQL->real_escape_string($name) . "'"; $result = $MySQL->query($query); if ($result->num_rows < 1) { return null; } $values = $result->fetch_assoc(); return Language::GetByAssoc($values); }
/** * Retrieves a single Language with the given ID * @param int $id The ID of the Language to return * @return NULL|\PhoenixSNS\Objects\Language The Language with the given ID, or NULL if no language with the given ID was found */ public static function GetByID($id) { if (!is_numeric($id)) { return null; } global $MySQL; $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "Languages WHERE language_ID = " . $id; $result = $MySQL->query($query); if ($result === false) { return null; } $count = $result->num_rows; if ($count < 1) { return null; } $values = $result->fetch_assoc(); return Language::GetByAssoc($values); }