You are here

function weather_store_metar in Weather 6.5

Same name and namespace in other branches
  1. 5.6 weather.module \weather_store_metar()
  2. 5 weather.module \weather_store_metar()

Stores parsed METAR data in the database

1 call to weather_store_metar()
weather_get_metar in ./weather.module
Fetches the latest METAR data from the database or internet

File

./weather.module, line 2104
Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world

Code

function weather_store_metar($metar, $next_update_on) {

  // If there's already a record in the database with the same ICAO
  // overwrite it
  $sql = "DELETE FROM {weather} WHERE icao='%s'";
  db_query($sql, $metar['icao']);

  // Insert the new data
  $sql = "INSERT INTO {weather}\n    (icao, next_update_on, metar_raw)\n    VALUES ('%s', %d, '%s')";
  db_query($sql, $metar['icao'], $next_update_on, $metar['#raw']);
}