static function getDataFromStation() { $sql = "SELECT * FROM meteo ORDER BY id DESC LIMIT 0, 1"; $baza = new BazaWeather(); $rezultat = $baza->query($sql); return $rezultat; }
public function connect() { // Try and connect to the database if (!isset(self::$connection)) { self::$connection = new mysqli(self::$host, self::$username, self::$password, self::$database); self::$connection->set_charset('utf8'); } // If connection was not successful, handle the error if (self::$connection === false) { // Handle error - notify administrator, log to a file, show an error screen, etc. echo 'Cannot connect to database.'; return false; } return self::$connection; }