You are here

function _weather_get_free_config in Weather 5

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

Return the first unused configuration number

1 call to _weather_get_free_config()
weather_custom_block in ./weather.module
Show a configuration page for a custom weather block

File

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

Code

function _weather_get_free_config($uid) {
  $result = db_query("SELECT * FROM {weather_config}\n    WHERE uid=%d\n    ORDER BY cid ASC", $uid);
  $free_config = 1;
  while ($config = db_fetch_array($result)) {
    if ($config['cid'] > $free_config) {
      break;
    }
    $free_config++;
  }
  return $free_config;
}