You are here

function _weather_get_free_config in Weather 5.6

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

Return the first unused configuration number

2 calls to _weather_get_free_config()
weather_custom_block in ./weather.module
Show a configuration page for a custom weather block
weather_main_page in ./weather.module
Show an overview of configured locations and the default location, if on the admin pages

File

./weather.module, line 941
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;
}