<?php
class GlobalConst
{
    public $db;

    public function __construct()
    {
        global $db;
        
        $this->db = $db;    }
    /**
     * 
     */
    public function load(string $name): ?string
    {
        $const = null;
        $sql = "
            SELECT *
            FROM ".MAIN_DB_PREFIX."const
            WHERE name ILIKE '{$name}'
        ";

        $res = $this->db->query($sql);
        while($adatok = pg_fetch_assoc($res)){
            if(!empty($adatok['value'])){
                $const = $adatok['value'];
            }
        }
        return $const;
    }
}